var myArray = [”John”, “Callum”, “Paul”, “Frank”];
for(var i = 0; i < myArray.length; i++) {
console.log(myArray[i]);
}
Can you work out for yourself what is going on here? Have a go at working your way through the loop, deciphering what is happening here and what the expected output will be.
Now let’s break it down together. Let’s see the code again, this time with some comments: