<HTML>
<body>
</body>
<script>
function camelize(line){
let line1 = line.split("-");
let set = "";
for(let word of line1){
if(word == line1[0]){
set = set + word;
continue;
}
alert(word);
word = word[0].toUpperCase() + word.slice(1);
set = set + word;
}
return set;
}
alert(camelize("background-color") == 'backgroundColor');
//set.join(''); using join "," is all between the words
</script>
</HTML>
<body>
</body>
<script>
function camelize(line){
let line1 = line.split("-");
let set = "";
for(let word of line1){
if(word == line1[0]){
set = set + word;
continue;
}
alert(word);
word = word[0].toUpperCase() + word.slice(1);
set = set + word;
}
return set;
}
alert(camelize("background-color") == 'backgroundColor');
//set.join(''); using join "," is all between the words
</script>
</HTML>
댓글
댓글 쓰기