Stage Error message for FizzBuzz


#1


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

Oops, try again. It looks like you printed out the wrong number of items.

```
num=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
console.log(num);
for(var i=0;i<20;i++)
{
    if( num[i]%3===0 && num[i]%5===0)
        console.log("FizzBuzz");
    else
    {
        if(num[i]%3===0)
            console.log("Fizz");
        else if(num[i]%5===0)
            console.log("Buzz");
        else
            console.log(num[i]);
    }
}

From the console I can see the output is correct. Still showing the error message.

`


#2

Are all the braces correct? Are any missing?


#3

Remove the first

console.log(num);

I think this particular CA's exercise counts that one as part of the number...


#4

OK...Understood. Thanks . Got it.

Thanks & Regards-
Kaushik Roy


#6

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

Form a habit of always using braces to denote code blocks, even when not needed.


#7

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