Need help on fizz buzz


#1

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

what am I doing wrong?


#2

for it to console.log FizzBuzz, it needs to be divisble by 5 and 3.

Why dont you add something to your if loop that would check that?

hint:

if( i % 3 === 0 "what should go here to check if both things are true?" i % 5 === 0) {
console.log("FizzBuzz") 
} else if {

#9

2 posts were split to a new topic: Why it's not working? All conditions are met


#11

A post was split to a new topic: Is my code correct?


#12