...And the good!



It's supposed to log "Fizz" if the number is divisible by 3, and Buzz if it's divisible by 5. If it's divisible by 3 and 5 it should print "FizzBuzz"; it says it's printing "Fizz" instead of "FizzBuzz".

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


Hi @johncdf,

Shift the condition if( i%3 === 0 && i%5===0) {console.log("FizzBuzz")} to become the first condition to be checked, the code run from top down.

You need the code to check this condition first rather than ( i%3 === 0), that is why it's printing "Fizz" first.


Ah, I see what I did wrong. Thanks alot, man!


You're welcome. :slight_smile:


This topic is solved.