FizzBuzz game


#1

// printing the number 1 to 20
for(var 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);
};
};

it's not working . it's showing fizz where should print fizzbuzz


#2

The order of your querys is incorrect

The request which more limited should at the beginning

if ((i % 5) === 0 && (i % 3) === 0)

#3

Thanks Dookoo_de. It works :smile:


#4

anaethossian You are Welcome :smile:


#5