1var colors=["red","blue","green"];
2for (let i = 0; i < colors.length; i++) {
3 console.log(colors[i]);
4}
1var listItem = [
2 {name: 'myName1', gender: 'male'},
3 {name: 'myName2', gender: 'female'},
4 {name: 'myName3', gender: 'male'},
5 {name: 'myName4', gender: 'female'},
6 ]
7
8 for (const iterator of listItem) {
9 console.log(iterator.name+ ' and '+ iterator.gender);
10 }