The Object.assign() Method in JavaScript - Set default options for functions

Veröffentlicht am: 21 Juni 2018
auf dem Kanal: dcode
23,212
534

The assign() method on the Object constructor in JavaScript is used to merge multiple objects together. You can use it to merge as many objects as you like.

If multiple objects have the same property, the "merged object" will also contain that property but the value of it will come from the last object passed in as an argument. This means it can be used to easily create "default options" within a function.

In this video I take you through examples of how you can use the Object.assign() method and also an example of using it to create default options in a function.

Support me on Patreon:
  / dcode   - with enough funding I plan to develop a website of some sort with a new developer experience!

For your reference, check this out:
https://developer.mozilla.org/en-US/d...

Follow me on Twitter @dcode!

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!


Auf dieser Seite können Sie das Online-Video The Object.assign() Method in JavaScript - Set default options for functions mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer dcode 21 Juni 2018 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 23,212 Mal angesehen und es wurde von 534 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!