const a = {x: "Hi", y: "Test"}
const b = ???
// b = {x: "Bye", y: "Test"}
// a = {x: "Hi", y: "Test"}
Es6 has a built in function for copying object properties, Object.assign
const b = Object.assign({}, a, {x: 'Bye'})
here we create an empty object, push all of a
s key value pairs in, followed by the new key value pairs we want to over write. because the empty object is the first argument, we mutate that object, not a