1var person={
2 first_name:"johnny",
3 last_name: "johnson",
4 phone:"703-3424-1111"
5};
6for (var property in person) {
7 console.log(property,":",person[property]);
8}
1let arr = [object0, object1, object2];
2
3for (let elm of arr) {
4 console.log(elm);
5}
1var people=[
2 {first_name:"john",last_name:"doe"},
3 {first_name:"mary",last_name:"beth"}
4];
5for (let i = 0; i < people.length; i++) {
6 console.log(people[i].first_name);
7}
1yourArray.forEach(function (arrayItem) {
2 var x = arrayItem.prop1 + 2;
3 console.log(x);
4});
1var arr = [{id: 1},{id: 2},{id: 3}];
2
3for (var elm of arr) {
4 console.log(elm);
5}
1//Only to be used if you need the numbers
2var array = new Array(item1,item2,item3)
3
4for(i=0;i<array.length;i++){
5 if(i==2){
6 console.log(array[i])
7 }
8}