Re:Using the switch(true) pattern in JavaScript
by ufo on Monday April 12, 2021 @06:36PM
(#26786047)
I have the same opinion. I like the early-return pattern when it's doing input validation or raising errors but for most other things I prefer how the if-else highlights that there are two possible paths that the code can take. Just because the "then" branch has a return statement doesn't mean that we should get rid of the "else".
[ Parent
| on HN ]
There are no comments on this comment yet.