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

TOP OF THREAD FULL DISCUSSION
re: I usually don't use switch statements at all, I prefer a having a dictionary object with a handler function for each case. const handlers = { ...
 

Oh cool, I’ve never seen this approach before! Gonna noodle on this one cause I’ve got a feeling there’s a tiny helper library in here waiting to be built to make the missing handler logic even more elegant and baked in. Thank you for sharing.

code of conduct - report abuse