vacationCompare step 3 not working


#1

My code:
var myPlaces = ["1", "2", "3"];
var friendPlaces = ["1", "2", "4"];

for (i = 0; i < myPlaces.length; i++)
{
console.log(myPlaces[i]);
}
Error:Did you a for loop that loops over the myPlaces array?
What is not working?


#2

You didn't define the variable i

You can do it like this:

for (var i = 0; i < myPlaces.length; i++)

Or like this (this for-loop is faster):

var i, len = myPlaces.length
for (i = 0; i < len; i++)

#3

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