javascript - Difference between Object.assign and just assign -
i know difference between this:
object.assign(otherobject, { somenewproperty: '' }); and
otherobject.somenewproperty = ''; and.. 1 faster?
thanks.
the object.assign() method used copy values of enumerable own properties 1 or more source objects target object. return target object.
whereas otherobject.somenewproperty = ''; method directly assign value property of object.
ofcourse second method, assigns value object dot notation faster.
you can check performance here: jsperf.com/diff-assign
Comments
Post a Comment