Sparky saysswitch matches one value against many cases — cleaner than a long if/else chain.
switch (x) compares x (with ===) against each case. Each case needs a break or execution "falls through" to the next — sometimes intentional for grouping. default handles the rest. For complex conditions, an object lookup is often cleaner than switch.
Power-ups you unlock
switch compares with === against cases
break stops fall-through
Intentional fall-through groups cases
default catches everything else
NaN the Trickster attacks — common mistakes
Forgetting break (accidental fall-through)
Using switch for range/complex conditions
No default case for unexpected values
Boss battleWrite a switch mapping a day number to a name, with a default.