I have two arrays here. Array 1 is an array of arrays consisting of some objects as follows:
var house = [
[
{ x: 50, y: 50, selected: false },
{ x: 150, y: 50, selected: false },
{ x: 250, y: 50, selected: false },
{ x: 350, y: 50, selected: false },
{ x: 450, y: 50, selected: false },
{ x: 550, y: 50, selected: false },
{ x: 650, y: 50, selected: false },
{ x: 750, y: 50, selected: false },
{ x: 850, y: 50, selected: false },
{ x: 950, y: 50, selected: false },
],
[
{ x: 50, y: 130, selected: false },
{ x: 150, y: 130, selected: false },
{ x: 250, y: 130, selected: false },
{ x: 350, y: 130, selected: false },
{ x: 450, y: 130, selected: false },
{ x: 550, y: 130, selected: false },
{ x: 650, y: 130, selected: false },
{ x: 750, y: 130, selected: false },
{ x: 850, y: 130, selected: false },
{ x: 950, y: 130, selected: false },
]
]
And array 2 consisting of some boolean values
var isSelected = [
false,
false,
false,
false,
false,
false,
true,
false,
false,
false,
true,
false,
false,
false,
false,
false,
false,
false,
true,
false
]
How can I iterate over these arrays so that if the value of any element in array 2 is true, then I must set the value of the property “selected” of the object in the corresponding array in array 1 to true as well?