Iterating Over an Array


#1

For some reason I am not able to log the elements of the array. The error msg tells me that I am missing "html".

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

for (var i=0; i< languages.length; i++){
    console.log [(i)];
}

#2

Hi what do you want to do with [(i)] ? you just need to pass the i inside the console.log

console.log("here")

#3

when i type console.log (i);

I don't get the elements in the array, I get numerals; think it's printing the numerical value of i during each iteration.


#4

If you want to print them put that inside the console.log

languages[i]

#5

Thanks. I forgot the "languages" so I was merely printing i. Spacey.


#6

Here is my code:

AND the log which clearly shows HTML; BUT, I get this message: Oops, try again. It looks like you didn't log 'HTML' to the console!

What to do now?


#7

Hi instead of 5 you should put languages.length then inside your `console.log() you should put languages[i]


#8

Thank you! I also removed the ; after my for statement.