Open ForeveHG opened 4 years ago
function transformCamelCase(name) {
return name.split('_').map((n, index) => index > 0 ? n.substr(0,1).toUpperCase() + n.substr(1) : n).join('')
}
//测试
transformCamelCase('a_c_def') //aCDef
transformCamelCase('a_bcd_efg') //a_bcd_efg
题目来源 https://github.com/haizlin/fe-interview/issues/12