Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to convert string to kebab case in javascript

const kebabCase = (string) => {
  const kebabCase = string => string
      .replace(/([a-z])([A-Z])/g, "$1-$2")
      .replace(/[s_]+/g, '-')
      .toLowerCase();

  const newText = kebabCase(string);
  return newText
};
Source by www.textbotonline.com #
 
PREVIOUS NEXT
Tagged: #convert #string #kebab #case #javascript
ADD COMMENT
Topic
Name
3+5 =