javascript function update object key with new value code example
Example 1: updating a key value on javascript object es6
var obj = {id: 1, name: "Adam"}
console.log(obj) // {id: 1, name: "Adam"}
obj = {...obj, name: "Eve"}
console.log(obj) // {id: 1, name: "Eve"}
Example 2: js change key value in object
var object = { boo:true, baa:5 };
console.log(object);
function change() {
object.boo = false;
object.baa++;
};
change();
console.log(object);
//Hope this helps!