Is my code correct?


#1

I NEED HELP ON MY FIZZ BUZZ TOO. IS MY CODE CORRECT?

for (var i = 0; i < 21; i++) {

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

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

    } else {
            console.log("Buzz");
            }

}


Need help on fizz buzz
#2

You are missing an important else if

else if (i % 5 === 0) {

} else {
    console.log(i);
}

#3

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