3... And the good!


#1

Hi I'm stuck on the "3... And the good!" exercise.

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

I get the error message "Oops, try again. There was a problem with your syntax."

I believe I have used a nested conditional which is what the exercise wants. Can someone help me find what I'm missing? Thank you


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


#2

Hi there,

if else(i % 5 === 0)

if and else are in the wrong order. It should be

else if(i % 5 === 0)

#3

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