DEV Community

Discussion on: When is code "too clever" / how do you think about readability/cognitive load?

Collapse
 
moopet profile image
Ben Sinclair

I'm the opposite. I'll use the short-circuit in a shell script, where it's common practice, but in JS I'll write it all out the long way, and I'll always include the block.

Collapse
 
joshcheek profile image
Josh Cheek

My preference for the short-circuit is b/c I think it's important to understand short-circuiting (as opposed to some things, which could be called "trivia"), and the short-circuit has the best signal to noise ratio.

My preference for removing the block is mostly because of better signal to noise ratio (ie less spammy), but also because I think it facilitates syntactic misunderstanding to use the block.