1var colors = ["red","blue","green"];
2for (var i = 0; i < colors.length; i++) {
3 console.log(colors[i]);
4}
1var array = [1, 2, 3, 4, 5];
2// made an array
3
4for (var i = 0; array[i]; i++) // browse your array with this simple condition on index
5 console.log('element '+i+' = '+array[i]);
6
7//output:
8element 0 = 1
9element 1 = 2
10element 2 = 3
11element 3 = 4
12element 4 = 5
1let colors = ['red', 'green', 'blue'];
2for (const color of colors){
3 console.log(color);
4}
1var array = ['Volvo','Bmw','etc'];
2for(var seeArray of array){
3 console.log(seeArray);
4}
1const friends = [
2 `Dale`,
3 `Matt`,
4 `Morne`,
5 `Michael`,
6];
7
8for (let i = 0; i < friends.length; i++) {
9 console.log(friends[i]);
10}