So This switch Statement Is Broken... Let’s Fix It
I was working on some JavaScript logic with a friend and wrote this:
let age = 18
switch (age) {
case age < 13:
console.log("child")
break;
case age<18:
console.log("Teenager")
}
Oops. Didn’t work.
❓ So What’s the Problem?
Turns out ...
codejanja.hashnode.dev2 min read