<script>
function getWord(str,mark) {
var new_str = str.split(mark);
var arr = [];
for (var i = 1; i < new_str.length; i++) {
arr.push(new_str[i].charAt().toUpperCase() + new_str[i].substr(1))
}
var ss = new_str[0] + arr.join('');
return ss;
}
var a = 'background-color';
var b = '-'
console.log(getWord(a,b));
//str传字符串
//mark传分割符
</script>