Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String.prototype.toCamelCase = function(){
- let self = this;
- return self.split(" ").map((word, i ) =>{
- // modify the regex to remove
- // any special characters
- return i > 0 ? word.replace(/(\"|,)/g,"").split("").map((l, j) => j == 0 ? l.toUpperCase() : l ).join("") : word;
- }).join("");
- }
Add Comment
Please, Sign In to add comment