DEV Community

Discussion on: Which would you prefer and why?

Collapse
 
barakplasma profile image
Michael Salaverry

If only one of the string manipulation functions should be run, then I would recommend ramdajs.com/docs/#cond which will only run the first condition which matches. The switch statement could run multiple times if a break or return is forgotten.