Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var string = "background-image";
- function camelization(str){
- str = str.toLowerCase();
- var strLen = str.length;
- var dashPosition = str.indexOf("-");
- var words = [];
- words[0] = str.substring(0, dashPosition);
- words[1] = str.substring(dashPosition + 1, strLen);
- var outp = words[0] + words[1].charAt(0).toUpperCase() + words[1].substring(1, words[1].length);
- console.log(outp);
- }
- camelization(string);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement