iterate each array object n time code example
Example 1: iterate through object array javascript
for (var key in array) {
var obj = myArray[key];
// ...
}
Example 2: iterate over array of objects javascript
// Just loop through an array
const myArray = [{x:100}, {x:200}, {x:300}];
myArray.forEach((element, index, array) => {
console.log(element.x); // 100, 200, 300
console.log(index); // 0, 1, 2
console.log(array); // same myArray object 3 times
});