change single key in object es6 code example
Example: 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"}
var obj = {id: 1, name: "Adam"}
console.log(obj) // {id: 1, name: "Adam"}
obj = {...obj, name: "Eve"}
console.log(obj) // {id: 1, name: "Eve"}