Help(Fizz, Buzz,FizzBuzz game)


#1

what is wrong with this code.
for(var i = 1; i<= 20; i++){
if(i%3===0 ){
console.log("Fizz");
}
else if(i%5===0){
console.log("Buzz");
}
else if(i%3!==0 && i%5!==0){
console.log(i);
}
else{
console.log("FizzBuzz");
}
}


#2

agree with me that if a number is divisible by 3 and 5, it also divisible by 3 or 5, agree? Which means your if statement will run, and log Fizz (even for numbers divisible by 3 and 5), it will never get to your else statement. The first thing i would do, is to check if i is divisible by 3 and 5.