Last active
May 2, 2019 17:21
-
-
Save artemrogov/ff0d787334027ce6178bbe4588d831fd to your computer and use it in GitHub Desktop.
перевращение из этого вида backgorund-color в backgorundColor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
*первращение из этого вида backgorund-color в backgorundColor | |
*@str строка | |
*return преобразованную строку | |
*/ | |
function camelize(str){ | |
var result = str.split("-"); | |
for (var i = 1; i<result.length; i++){ | |
result[i] = result[i].charAt(0).toUpperCase() + result[i].slice(i); | |
} | |
return result.join(''); | |
} | |
/** | |
* пример реализации: | |
*/ | |
var r = camelize("background-color"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment