Hi, where is my mistake?
for (var i = 1; i <= 20; i++) {
console.log(i);
}
if(i % 3 === 0){
console.log(“Fizz”);
}
else if(i % 5 === 0)
console.log(“Buzz”);
else if (i % 3 && i % 5 === 0) {
console.log(“FizzBuzz”);
}
else {
console.log(i);
}
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(“FizzBuzz”);
}
else {
console.log(i);
}
}
It does not print FizzBuzz
for (var i = 1; i <= 20; i++) {
if (i % 3 === 0 && i % 5 === 0) {
console.log(“FizzBuzz”);
}
else if(i % 3 === 0){
console.log(“Fizz”);
}
else if(i % 5 === 0){
console.log(“Buzz”);
}
else {
console.log(i);
}
}
seems you solved it yourself pretty quickly?