Am I getting this?


My code works fine, but I just want to make sure I understand how it's actually working. As I understand it, I have defined two different variables, names and i, and then I put them in relationship to each other by using names[i]. Yes?

var names = ["Adam", "David", "Monty", "Dan", "Nick"];

for (var i = 0; i <= 4; i++) {
console.log("I know someone called" + " " + names[i])


You created a variable called names which is an array.
A variable called i that is equal to 0.

Arrays are accessed by calling the value of the item you want to access. They start with the value of 0.

The for loop is increasing the value of "i".
Thus cycling through the names array When you call names[i]