Can you help me


#1


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


Oops, try again. You printed Fizz when you should have printed FizzBuzz

<do not remove the three backticks below

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


#2

for i=15, if is true (15 is divisible by 3), so fizz is printed, the loop moves on to the next number

how can we overcome this problem? what could we change? Maybe the order in which we check if the number if fizz, buzz or fizzbuzz?


#4

I just changed the order. Check for the number being divisible by both 3 and 5 first the do the rest


#6

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