3.And the goal!


#1

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

"It looks like you printed out the wrong number of items!"

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

#2

20 should be included, in your case its not


#3

Ok, thanks.

But now it says - "You printed Fizz when you should've printed FizzBuzz".


#4

for i=15 you want to log fizzbuzz. but your if condition:

15%3===0

so fizz will be printed, and the loop moves on to the next number

check if number is fizzbuzz first


#5

Oh wow thank you so much sir :slight_smile:


#6