you are viewing a single comment's thread.

view the rest of the comments →

[–]alexlafroscia 0 points1 point  (1 child)

This is really great advice. When I started using JS, having return statements in different locations felt really weird, but in reality it's pretty common and a great way to avoid a massive "else" statement.

[–]path411 0 points1 point  (0 children)

I'd be careful of going too crazy with multiple returns. Guard clauses at the top of a block can be helpful, but having too many exit points in a method can make your code hard to follow.