Updating JavaScript object-attributes from another object [duplicate]

I suggest using underscore.js (or better, lo-dash) extend:

_.extend(destination, *sources)

Copy all of the properties in the source objects over to the
destination object, and return the destination object. It’s in-order,
so the last source will override properties of the same name in
previous arguments
.

_.extend({name: 'moe'}, {age: 50});
=> {name: 'moe', age: 50}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)