Help. Noob at coding


Hey All, Im new to coding and I’m stuck on the Javascript’s loops lesson. I got through it but i don’t understand why we have to use “i” for animals. For example the source code says that it uses the code “animals[i]” but i don’t see that in the source code below.

var animals = ["Grizzly Bear", "Sloth", "Sea Lion"];

for (var i = 0; i < animals.length; i++) {


if you step the FOR LOOP, you get:


at any step the console.log, inside the loop will have a new value of "i"
console.log(animals[i]) = console.log(animals[0])
console.log(animals[i]) = console.log(animals[1])
console.log(animals[i]) = console.log(animals[2])


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.