3/33 "... And the good!"


#1


When I run the code below I get the error "You printed Buzz when you should have printed 1" but the printout I get is:
Buzz
19
Fizz
17
16
FizzBuzz
14
13
Fizz
11
Buzz
Fizz
8
7
Fizz
Buzz
4
Fizz
2
1


for(i=20;i>0;i--){
    if(i%3===0 && i%5!=0){
        console.log("Fizz")
    }
    else if(i%3!=0 && i%5===0){
        console.log("Buzz")
    }
    else if(i%3===0 && i%5===0){
        console.log("FizzBuzz")
    }else{
        console.log(i)
    }
}


#2

Apparently I misread the instructions and thought you had to count from 20 - 1 instead of 1 - 20.

Reading is hard


#3

did you manage to get it to work now?


#4

Yeah, sorry. I managed to get it to work by fixing it to count upwards instead of downwards.


#5

no need to apologize, i just wanted to make sure you got the code to work. Otherwise i would have offered you further assistance.


#6

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