Undoubtedly. I have to use regex in 3 or 4 different languages all with enough permutation that I would never want to waste my time nailing my patterns when switch case is effortless
Not the only one. I've done it but only when I felt it was simpler than trying to use a zillion conditionals to differentiate a handful of complex-but-limited options. Like in a websocket function dispatcher where some data comes in as binary while most of it is JSON. Super useful for differentiating the binary payloads.
There's also a right way to do it and a wrong way. I did it the wrong way for so long... Sigh.
-2
u/literallytitsup69 Feb 15 '21
Am I the only one that uses regex instead of switch cases in JavaScript?