3....And the Good


#1

for(i=0;i<21;i++){
if(i%5===0){
console.log("BUZZ");
}
else if(i%3===0){
console.log("FIZZ");
}
else if(i%3===0&&i%5===0){
console.log("FIZZBUZZ");
}else console.log(i);
}

Hi I need help, I've been stuck in here.It says. Oops, try again. It looks like you printed out the wrong number of items. Can someone guide me whats wrong :frowning:


#2

try to use "Fizz", "Buzz", "FizzBuzz" instead uppercase


#3

This is the correct answer. The important piece is after the 1st "if" statement which checks to see if i % 3 == 0 and the goes even further to check if i % 3 and i % 5.

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


#4

Hi Thank you, Seems like the editor is a bit sensitive :smiley: