Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
btown
on April 12, 2021
|
parent
|
context
|
favorite
| on:
Using the switch(true) pattern in JavaScript
I agree; `if (` is much more well-known and "grokkable" to engineers at practically any level than `case` - and exactly the same number of characters. There's no need to bring a sledgehammer when the nail is perfectly handled by a normal hammer.
layer8
on April 12, 2021
[–]
I agree, but the problem presumably is the “else”.
Consider applying for YC's Spring batch! Applications are open till Feb 11.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: