Looping array/lists with "in". 3. for loops


#1


I'm not really stuck.


Is it acceptable to use that code? I used in Python and wondered if JavaScript has that feature. The console returns the right code but the exercise doesn't let me pass.

I know the exercises are strict and needs to be done in a very specific way. I just want to know for sure if that code works in JavaScript.


var vacationSpots = ['Paris', 'New York', 'Barcelona'];

for (var i in vacationSpots) {
  console.log(vacationSpots[i]);
}


#2

Use the code that Codecademy asks for to pass the lesson.

JavaScript-wise, your code is good to go. :slight_smile:


#3

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