Which property on arrays can be used to loop through them? code example
Example 1: javascript loop through array of objects
let arr = [object0, object1, object2];
for (let elm of arr) {
console.log(elm);
}
Example 2: ho to loop trough an array of objects
yourArray.forEach(function (arrayItem) {
var x = arrayItem.prop1 + 2;
console.log(x);
});
Example 3: javascript loop through array of objects
var arr = [{id: 1},{id: 2},{id: 3}];
for (var elm of arr) {
console.log(elm);
}