Object.assign():

well, object assign in JavaScript does the shallow copy of it’s own properties and values from the sources to the target object and returns the target object.

Syntex:

confused?? checkout the example below

const targetObj = Object.assign({}, ‘string’, null, 12, undefined,{keyObj: “valObj”},[‘string’, ‘12’, { keyArr: “keyVal” }]);

sagar kulkarni

Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store