javascript

Slugify a string using JavaScript

The following JavaScript function will slugify a given string. For example, passing My New Category would return my-new-category

const slugify = value => value.toLowerCase()
                              .replace(/ /g,'-')
                              .replace(/[^\w-]+/g,'');

more JavaScript posts