<3> And The Good


#1

https://www.codecademy.com/courses/spencer-sandbox/0/3?curriculum_id=506324b3a7dffd00020bf661#

It says there was a problem with your Syntax.

Please help


#2

var numbers= [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14, 16, 17, 18, 19, 20];
/*there is an easier way though like.... 1-20*/
for (var i= 1; i < 21; i++);

if ( i % 3 === 0 && i % 5 === 0){
console.log("FizzBuzz");
}
else if (i % 5 === 0){
console.log ("Buzz");

} else if (i % 3 === 0){
console.log ("Fizz");
}else{
    console.log(i);
}
};

#3

Hi @metaphyzist,

Have a look at this line of code:

for (var i= 1; i < 21; i++);

semicolons are used for ending statements. Where you have placed that semicolon is not the end of your for loop. for loops should look like this:

for ( ... ) {
   // do this stuff each time around
}

Do you see the problem now?


#4

Thanks a lot. The more you look the less you see. I tried so hard to debug this myself before bringing it here. But it turns out that the problem was just staring at me.
thanks once more.


#5

When you are first learning, it is hard to tell what is important and what isn't. This sort of thing will become much clearer as you continue coding.


#6

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