To map over an object and change one properties value using JavaScript, we use the spread operator.
For instance, we write
const original = { a: 1, b: 2 };
const copy = { ...original, c: 3 };
to spread the properties of the original
object into the copy
object.
And we add the c
property to copy
to set ites c
property to 3.