7/3 ...And the Good


#1

The following code gives me this error: "You printed Fizz when you should have printed FizzBuzz"
Can anyone tell me why?(The number that is supposed to print Fizz Buzz is 15)

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


#2

The condition here:

is true because 15 % 3 = 0. The program prints on console "Fizz" and never reach the code after else.

Try to put first this condition: