javascript update multiple values of an object code example
Example: javascript update multiple values of an object
var myObject = {
label: 'foo',
name: 'bar',
id: 12
};
myObject = {...myObject, label: 'baz', name: 'qux'};
console.log(myObject);
// Or, if your update is contained in its own object:
var myUpdate = {
label: 'something',
name: 'else'
}
myObject = {...myObject, ...myUpdate}
console.log(myObject)