https://learn.javascript.ru/task/camelcase

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
var camelize = function(str) {
var a = str.split('');
for (var i = 0; i < str.length; i++) {
if (a[i] == '-') {
a[i + 1] = str.charAt(i + 1).toUpperCase();
delete a[i];
}
}
return a.join('');
};
alert(camelize("background-color"));
alert(camelize("list-style-image"));
alert(camelize("-webkit-transition"));