JavaScript Fundamentals: Merging Objects with Object.assign()

preview_player
Показать описание

Would you like to help keep this channel going?

Tutorials referred to in this video:

For more resources on JavaScript:

#javascript #AllThingsJavaScriptLLC
Рекомендации по теме
Комментарии
Автор

As always, great summary, thank you!

AlazTetik
Автор

I really enjoyed this one, thanks. After playing with Object.assign() for a while I can confirm it works perfectly well for arrays (including cloning using newArray = Object.assign([], sourceArray)). You just have to remember array indices are numerical object keys and so equivalent indices are overwritten in the target. Of course it also copies named keys added to the array object and could be quite useful.

batchrocketproject
Автор

Very useful. Thanks!

It's also possible to deep clone using JSON methods like so;

const deepClonedObj = JSON.parse(JSON.stringify(Object.assign({}, obj)));

gunman
Автор

I am following your content on skillshare... But sir why do you remove your content from skillshare? 😢😢😢

kajalpramanik