Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var string = "background-image";
  2.  
  3.  
  4. function camelization(str){
  5.      str = str.toLowerCase();
  6.      var strLen = str.length;
  7.      var dashPosition = str.indexOf("-");
  8.      var words = [];
  9.      words[0] = str.substring(0, dashPosition);
  10.      words[1] = str.substring(dashPosition + 1, strLen);
  11.      var outp = words[0] + words[1].charAt(0).toUpperCase() + words[1].substring(1, words[1].length);
  12.      
  13.      console.log(outp);
  14. }
  15.  
  16. camelization(string);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement