The Ultimate Way to Slugify a URL String in JavaScript
Turn “this URL-optimized string” into “this-url-optimized-string” easily with this snipped of JavaScript code.
With the advent of Node.js and modern application endpoint routing, I find it surprising that there is no in-built function to convert any string into an URL-optimized slug.