3. ...And the good!


#1

  1. ...And the good! Syntax error?


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


#2

By the time the program gets to this line, number is neither 3 nor 5 so will never print FizzBuzz. Consider having this condition come first in the order.

The line is also the one containing the syntax error. See if you can spot it.


#4