Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Create slug from string in Javascript

const slugify = str =>
  str
    .toLowerCase()
    .trim()
    .replace(/[^ws-]/g, '')
    .replace(/[s_-]+/g, '-')
    .replace(/^-+|-+$/g, '');
Source by www.30secondsofcode.org #
 
PREVIOUS NEXT
Tagged: #Create #slug #string #Javascript
ADD COMMENT
Topic
Name
9+5 =