3.... And the good!


#1


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

I get it to print out the following, but I guess it's not exactly what it's looking for.

1
2
Fizz.
4
Buzz.
Fizz.
7
8
Fizz.
Buzz.
11
Fizz.
13
14
FizzBuzz!
16
17
Fizz.
19
Buzz.

But it says, "Oops, try again. You printed Fizz. when you should have printed Fizz"

How else should the console log look after running my code?

Thanks,

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

#2

Never mind...

I needed to take out the periods at each console log.

console.log("FizzBuzz")
instead of console.log("FizzBuzz!")

So it works now.


#3

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