Guest User

Untitled

a guest
Jun 18th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. String.prototype.toCamelCase = function(){
  2. let self = this;
  3. return self.split(" ").map((word, i ) =>{
  4. // modify the regex to remove
  5. // any special characters
  6. return i > 0 ? word.replace(/(\"|,)/g,"").split("").map((l, j) => j == 0 ? l.toUpperCase() : l ).join("") : word;
  7. }).join("");
  8. }
Add Comment
Please, Sign In to add comment