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}
1// Event snippet for Purchase (Google Ads - 7 day click, 1 day view) conversion page
1//create an array like so:
2var colors = ["red","blue","green"];
3
4//you can loop through an array like this:
5for (var i = 0; i < colors.length; i++) {
6 console.log(colors[i]);
7}
8