News for hackers. Stuff that matters.
Re:Using the switch(true) pattern in JavaScript by 1_player on Monday April 12, 2021 @02:03PM (#26782806)
Early return is my silent gauge to tell if a piece of code has been written by a junior or a senior software engineer.

I still see far to many snippets with multiple levels of indentation, where each if branch is for the happy path, and if they were converted to early returns you could flatten the whole thing to 1 indentation level, at the expense of requiring negated boolean expressions which aren't as readable.

There are no comments on this comment yet.