3. And the Good: What am I doing wrong?


#1


https://www.codecademy.com/courses/spencer-sandbox/0/3?curriculum_id=506324b3a7dffd00020bf661#


The error I am receiving says:

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


for (var i; 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{(!(i % 3 === 0 && i % 5 === 0)) 
        console.log(i);
    }
};


#2

@netjumper97942,
The FOR-loop definition

for ([initialization]; [condition]; [final-expression]) {
   statement
}

You will want to extend the
initialization like
var i = 1 ;

and use the comment signiature in the ELSE statement structure
like
// (!(i % 3 === 0 && i % 5 === 0))


#3

netjumper997942, trust me, i was in that situation for quite a while. I've copied your code and made the adjustments, just go ahead and cpoy down what's below: :wink:

for (var i; 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

Thank you very much!


#5

A post was split to a new topic: Having an issue passing this exercise


#6