js把下划线字符串转为大驼峰字符串
let str = "zifu_chuan_chang"
function func(str)
{
let arr = str.split('_')
let resStr = arr.reduce(function(prev, cur){
let str = prev + cur.slice(0, 1).toUpperCase() + cur.slice(1)
return str
})
// 转小驼峰这一行不需要
resStr = resStr.slice(0, 1).toUpperCase() + resStr.slice(1)
return resStr
}
console.log(func(str))
这是我的签名