re: Why I prefer objects over switch statements VIEW POST

TOP OF THREAD FULL DISCUSSION
re: good article, ive been doing similar recently but i used es6 Maps and dynamic keys const fn = n => new Map([ [n < 2, 'Less than 2'], [...
 

Nice.
On the down side, you have to be careful that no more than one condition is verified.
On the plus side, '_' looks like a confused face 😐😀

Anyway, you can do that with objects, too, but booleans would get converted into strings.

 
code of conduct - report abuse