4. iterating over an array


#1

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

i am getting the output but it says that "you dint log html to the console"
cant figure it out..


#2

I want to believe that there are test scripts behind every exercise. You should remove all the strings before languages[i] so that it sees HTML first.


#3

You might want to make sure this text string matches the one from the instructions.


#4

I had the same issues. It's actually logging "I know HTML" right at the top, but its telling me it didn't log HTML?

Here's my code:

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


#5

found the fix, they don't want you to put anything before the items in the array. Get rid of "I know" in the statement and it works.


#6

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