Consider having an object structured as shown below, with multiple items:
myObject:{
item1: {
visible: true;
},
item2: {
visible: true;
},
item3: {
visible: false;
},
}
Additionally, there is an array of objects as follows, with potentially numerous items:
var objs = [
{ name: 'item1', visible: false },
{ name: 'item2', visible: false },
{ name: 'item3', visible: false }
];
The challenge is to loop through the object and update the visibility in the array only if the identifiers match. For instance, when item1's visibility is false
in the object, it must also be updated in the corresponding item1 within the array.