Say I have two objects:
let obj1 = {
name: 'obj 1',
id: 1,
color: "#fff",
pages: []
}
let obj2 = {
name: 'obj 2',
id: 2,
color: "#ddd"
}
I want to write a function that follows this logic 'loop through obj1, and if both obj1 and obj1 have the same property, update obj1's property with obj2's value'
So result would return obj1 with the value:
{
name: 'obj 2',
id: 2,
color: "#ddd",
pages: []
}
I'm having a bit of an issue dealing with objects since I can't forEach or map them.