Skip to content

Tag: switch-statement

Switch…case in JS

This simple problem gives me an error. Does not get the correct answer. I will be glad if you help. Output: You did not pass Answer this way can you explain why we write true? – Hussein Nadjafli (PO) The JS switch only works on strict equality. is equivalent to in your code you replace the possible values [’x…

javascript fizzbuzz switch statement

I’m currently taking the code academy course on Javascript and I’m stuck on the FizzBuzz task. I need to count from 1-20 and if the number is divisible by 3 print fizz, by 5 print buzz, by both print fizzbuzz, else just print the number. I was able to do it with if/ else if statements, but I wante…