Iterating over an array


#1


https://www.codecademy.com/courses/javascript-beginner-en-9Sgpi/0/4?curriculum_id=506324b3a7dffd00020bf661#


I'm not sure what I've done wrong here. It states "Oops try again. It looks like you didn't log 'HTML' to the console!"


var languages = ["HTML", "CSS", "JavaScript", "Python", "Ruby"];
for (var i = 0; i < languages.length ; i++)
{
    console.log(i);
}


#2

i in your code is just an index. To retrieve data from the array you have to use languages[i].


#3

Ohh I understand, thank you so much.


#4

You're very welcome.


#5

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