3.For loops error


#1

Hi Guys,

I pushed this code, for 'for loops' in the javascript exercise. It isn't wrong, i have requested the right code, it was the same I had, but the error message keeps playing.

This is it

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

for (var i = 0; i < vacationSpots.length; i++) {
console.log('I would love to visit ' + vacationSpots[i]);
}

Can anyone tell what's wrong with this?

Simon


#2

What error message are you receiving? Can we have a link to the lesson so we can see the instructions and test the code, please? Thanks.


#3

I have the same problem as well. Here's the link to the lesson any help would be appreciated.
https://www.codecademy.com/courses/learn-javascript/lessons/loops/exercises/for-loop?action=lesson_resume


#5

I ran your code and it was accepted, and output,

I would love to visit Paris
I would love to visit New York
I would love to visit Barcelona

#6

hello the problem is in the console.log you need to put this code there
its a small change but for me it workt.

replace this:
console.log('I would love to visit ' + vacationSpots[i]);
with this:
console.log(vacationSpots[i]);

happy coding.


#7

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