News for hackers. Stuff that matters.
Re:Using the switch(true) pattern in JavaScript by wvenable on Monday April 12, 2021 @05:59PM (#26785715)
For a single condition it doesn't matter much either way for readability. But once you have a number of conditions the if/else style becomes unwieldy.

I put all my early returns at the top as these are the preconditions for the rest of the code; I don't think that's hard to understand.

There are no comments on this comment yet.