foreach object property with array javascript code example
Example 1: javascript loop through array of objects
var arr = [{id: 1},{id: 2},{id: 3}];
for (var elm of arr) {
console.log(elm);
}
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])
}
}