# ...And the good!

#1

I've been stuck on the, "...And the good!" lesson for quite a while now. I've used a few variations of syntax but none have worked. This is what I currently have. Any ideas?

for (i = 1; i < 20; i++);
if ( i % 5 === 2 || i % 5 === 4){
console.log("Buzz");
}

else if(i % 3 === 2 || i % 3 === 3 || i % 3 === 4 || i % 3 === 6 || i % 3 === 7 || i % 3 === 8 || i % 3 === 9 ){
console.log("Fizz");
}

else if(i % 3 === 5 ){
console.log("FizzBuzz");
}
else{
console.log(i);
};

#2

@bluejaywinters PLEASE Take a look at THIS.

#3

I recommend researching how the modulus (%) works - there was an early lesson on this, perhaps you should revisit it. If a number is divisible by something, the remainder should be zero.

For example, if I wanted to find out if 33 was divisible by 11, 33%11 should be equal to zero.

#4

#5

The % modulo is to see if a number is divisible or not, so :
20 % 5 === 0; 20 is divisible by 5, the remainder is 0.
10 % 2 === 0; 10 is divisible by 2, the remainder is 0.
10 % 3 === 1; 10 is not divisible by 3, the remainder is 1.

So you must set :
i % 3 === 0. // if the number i is divisible by 3, console.log("FIZZ"). instead of "i % 3===5".

#6

Hi mi code work's but i don't now if is 100% correct soo...

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

#7

It is correct but instead of write "if ( i % 3 === 0 ) {
if ( i % 5 === 0 ) {
console.log ( "fizzbuzz");
}
};
it is much more nice and cleaner to do :
if (( i % 3 === 0 ) && ( i % 5 === 0)) {
console.log ( "fizzbuzz");
}

#8

but in complete syntax?