js looping through array of objects returns 0? code example
Example 1: javascript loop through array of objects
var people=[
{first_name:"john",last_name:"doe"},
{first_name:"mary",last_name:"beth"}
];
for (let i = 0; i < people.length; i++) {
console.log(people[i].first_name);
}
Example 2: javascript loop through array of objects
yourArray.forEach(function (arrayItem) {
var x = arrayItem.prop1 + 2;
console.log(x);
});