DEV Community

Discussion on: A New Coding Style for Switch Statements in JavaScript/TypeScript

Collapse
 
evanplaice profile image
Evan Plaice

Depends. Probably not significant unless it's really hot code (ex parser stap).

That likely wouldn't be a significant deal breaker, just worth considering.

My main counter is, why increase complexity, making the code both harder to read and maintain when defining entry using 'let' is much simpler/easier to understand.

To each their own. I bias heavily toward simple/maintainable code even of it's not 100% semantically perfect. Ie avoid adding complexity unless it's 100% necessary.

Thread Thread
 
nebrius profile image
Bryan Hughes

I think defining using a let is the harder to read and maintain option than my option, and going that path increases complexity TBH.