Skip to content

Instantly share code, notes, and snippets.

@sudhir600
Forked from johnsmith17th/camelCase.js
Created May 29, 2019 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sudhir600/5d998a787082d78ef15c54046e81a05c to your computer and use it in GitHub Desktop.
Save sudhir600/5d998a787082d78ef15c54046e81a05c to your computer and use it in GitHub Desktop.
To convert string to camel case in javascript.
function toCamelCase(str) {
return str.toLowerCase().replace(/(?:(^.)|(\s+.))/g, function(match) {
return match.charAt(match.length-1).toUpperCase();
});
}
@sudhir600
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment