update object where js code example
Example 1: how to update object in javascript
myObject['first name'] = 'John'; // property name with a space
Example 2: update object within object by id js
//This will replace myId of the item id with the updated object
return myArray.map((item) => {
return item.id === myId
? UPDATED_OBJECT_HERE
: item;
});