re: A New Coding Style for Switch Statements in JavaScript/TypeScript VIEW POST

re: In this example I'm not trying to set one variable from multiple places. Rather, I'm trying to set two different variables once each that never cha...

Yeah, a place I've done this is in writing switch statements in reducers. The extra scope also closes over any intermediate values you have so you don't have to coordinate variable names between blocks. I do this routinely for all switch statements all the time for this reason. The semantics are more useful and obvious with the braces.

code of conduct - report abuse