Iterating over an Array


#1

var languages = ["HTML", "CSS", "JavaScript", "Python", "Ruby"];

for(i=0; i<languages.length; i++){
console.log(languages);
}
What is wrong in this code?


#2

here:

console.log(languages);

languages is the array, you need to log each element in the array. this is why you build the loop


#3

So what should I do?


#4

log each language to the console by using i as index to access items from the array


#5

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