Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to convert string to camel case in javascript

const camelCase = (string) => {
  function camelize(str) {
    return str
      .replace(/(?:^w|[A-Z]|w)/g, function(word, index) {
        return index === 0 ? word.toLowerCase() : word.toUpperCase();
      })
      .replace(/s+/g, "");
  }
  const newText = camelize(string);
  return newText
};
Source by www.textbotonline.com #
 
PREVIOUS NEXT
Tagged: #convert #string #camel #case #javascript
ADD COMMENT
Topic
Name
3+5 =