...And the good


#1

I really need help with this lesson. I have tried everything, even looking at the Q&A forums to find a solution, but nothing has worked.

https://www.codecademy.com/en/courses/spencer-sandbox/0/3?curriculum_id=506324b3a7dffd00020bf661#
When I run my code, it prints “Fizz” and “FizzBuzz”, but not “Buzz”. It is also printing FizzBuzz in some of the wrong places. When I print my codes get an error message that says, “Oops, try again. You printed FizzBuzz when you should have printed Buzz”. Please help:slightly_frowning_face:

for(var i = 1; i <= 20; i++) {
if(i % 3 && 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
if (i % 3 === 0 && ...

#3

Thank you so much! This code was really confusing me!:slightly_smiling_face:


#4

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