Error in play a game of FizzBuzz


#1

Hello folks,

The below is the code that I wrote for the play a game task.

var i;

for(i=1;i<21;i++)
{
    console.log(i);
}
for(i=1;i<21;i++)
{
    if(i%3===0 && i%5===0)
    {
        console.log("FizzBuzz");
    }
    else if(i%3===0)
    {
        console.log("Fizz");
    }
    else if(i%5===0)
    {
        console.log("Buzz");
    }
    else
    {
     console.log(i);
    }
}


    Though i did the tasks in a correct way, but still i got an error of "It looks like you printed out the wrong number of items.". can any one of you please help me from this error.

#2

HI just remove this part

for(i=1;i<21;i++)
{
    console.log(i);
}

#3

Thank you . The error is resolved.


#4

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