JavaScript -Schleife durch Array von Objekten
let arr = [object0, object1, object2];
for (let elm of arr) {
console.log(elm);
}
garzj
let arr = [object0, object1, object2];
for (let elm of arr) {
console.log(elm);
}
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);
}
var myArr = [{name: 'rich', secondName: 'james'}, {name: 'brian', secondName: 'chris'}];
var mySecondArr = myArr.map(x => x.name);
console.log(mySecondArr);
yourArray.forEach(function (arrayItem) {
var x = arrayItem.prop1 + 2;
console.log(x);
});
const people = [
{name: 'John', age: 23},
{name: 'Andrew', age: 3},
{name: 'Peter', age: 8},
{name: 'Hanna', age: 14},
{name: 'Adam', age: 37}];
const anyAdult = people.some(person => person.age >= 18);
console.log(anyAdult); // true
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