...And the good! Need help with FizzBuzz quest


#1

Instructions:
1. Print out the numbers from 1 - 20.
2. The rules:
For numbers divisible by 3, print out "Fizz".
For numbers divisible by 5, print out "Buzz".
For numbers divisible by both 3 and 5, print out "FizzBuzz" in the console.
Otherwise, just print out the number.


My code:


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


Output:


1
2
3
Fizz
4
5
Buzz
6
Fizz
7
8
9
Fizz
10
Buzz
11
12
Fizz
13
14
15
Fizz
FizzBuzz
16
17
18
Fizz
19
20
Buzz


Error:


Oops, try again. It looks like you printed out the wrong number of items.


Please help me!


#2

Please refer to this link: ... And the Good!