It keeps saying Oops, try again. It looks like you printed out the wrong number of items. And I do not know why


#1

for (i = 1; i < 20; i++) {
console.log(i);

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


#2

Two things:

1)if (i % 5 === 0) { instead of if (i % 5 === 1) {

2) Put if (i % 5 === 0 && i %3 === 0) { in front of the other "if" statements.


#3

It keeps saying the same thing

for (i = 1; i < 20; i++) {
console.log(i);

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


#4

I also deleted those extra parentheses


#5

Hi @amanodude

If it may help please see the code example below. In short there are just a few errors you would need to update in order to pass the lesson. Comments are included below rather than long wind this post :smile:

for (i = 1; i <= 20; i++) { //if you are going to use 20 to evaluate, in order to meet lesson requirement use <=
//console.log(i); remove this once done testing in order to pass the lesson

    if (i % 5 === 0 && i % 3 === 0) {
        console.log("FizzBuzz");
    } 
    else if (i % 5 === 0) { //you need to check for 0 not 1
        console.log("Buzz"); //5 is Buzz
    } 
    else if (i % 3 === 0) {
        console.log("Fizz");//3 is Fizz
    } 
    else {
    console.log(i);
    }
};

#6

Thanks that helped A LOT :smile: