3 and the good!


#1

Can't seem to get what is wrong.

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

}

The error I get is: SyntaxError: missing before statement


#2

Might be that console.log("Fizz") doesn't have a semi-colon after it.


#3

You were right, it was missing as was the last part which I replaced both. My code now looks like this, but I still get the same error.

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


#4

In the second "else" you're missing the "if to make it "else if", also you'll have to move the"FizzBuzz part to the beginning because if not it will print "Fizz" instead of "FizzBuzz when it reaches 15 as it is the first true statement.