Answers for "iterate over array of objects in javascript"

53

javascript loop through object array

var person={
 	first_name:"johnny",
  	last_name: "johnson",
	phone:"703-3424-1111"
};
for (var property in person) {
  	console.log(property,":",person[property]);
}
Posted by: Guest on July-22-2019
0

iterate over array of objects javascript

// Transform to a new array

const myArray = [{x:100}, {x:200}, {x:300}];

const newArray= myArray.map(element => element.x);
console.log(newArray); // [100, 200, 300]
Posted by: Guest on January-02-2021
-1

iterate over array of object javascript and access the properties

for (let item of items) {
    console.log(item); // Will display contents of the object inside the array
}
Posted by: Guest on April-29-2020

Code answers related to "iterate over array of objects in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language