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

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
I’m not really stuck.

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
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]);
}

<do not remove the three backticks above>

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

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

1 Like

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