... And the Good., Please whats wrong someone check my code


#1

Whats frong with this..
for (var i = 0; i <=20; i++) {
console.log(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);
}

};


#2

The first console log you use in the second line is not needed and is going to print every number
When using a && you dont need to use () for each statment.
if (number % 5 == 0 && number % 3 == 0) {
console.log('FizzBuzz');
}


#3

But it still says that : - "Oops, try again. It looks like you printed out the wrong number of items."

I made changes tried several types
Actually it console.logs All Numbers and like this:
FizzBuzz
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
17
Fizz
19
Buzz

There is full code again.

for (var i = 0; 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);
}
};


#4

You need to start at var i = 1 not 0. You need to count from 1 to 20.


#5

Thank you. I works. I just couldn't thing of that.. Thank you again.


#7

Sorry, somehow I didnt see the other comments...