...And the good!


#1

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

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

Not sure what I'm missing or doing wrong. Please help. Thanks.

for(i = 1; i < 21; 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);
            }
    }


Preformatted text


#2

Your o/p does not match with CC's o/p because of one reason!

this..
console.log(i); (console.log() at the starting of your code)

hint**
(try this and do reply what you get!)
If you eliminate it ?


#3

Hey greentreemee,
Thanks for replying.

Good call. Yea, I didn't need the console.log(i); on the second line. It's working now.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.