for loop thru an array of objects code example
Example 1: javascript loop through object example
var person={
first_name:"johnny",
last_name: "johnson",
phone:"703-3424-1111"
};
for (var property in person) {
console.log(property,":",person[property]);
}
Example 2: javascript for loop array of objects
var array = ["e", 5, "cool", 100];
for (let i = 0; i < array.length; i++) {
console.log(array[i]);
}
// This is a common method used to loop through elements in arrays.
// You can use this to change elements, read them, and edit them