iterate through an array of objects and check for conditios code example
Example 1: how to loop through an array of objects in javascript
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
});
Example 2: javascript loop through array of objects
//Only to be used if you need the numbers
var array = new Array(item1,item2,item3)
for(i=0;i<array.length;i++){
if(i==2){
console.log(array[i])
}
}