function test(str){
const a = str.split(" ").map(item=>item[0].toUpperCase()+item.substring(1)).join(" ")
return a
}
document.write(test("a23 b23 ccc2123 1"));
输出结果:
A23 B23 Ccc2123 1
function test(str){
const a = str.split(" ").map(item=>item[0].toUpperCase()+item.substring(1)).join(" ")
return a
}
document.write(test("a23 b23 ccc2123 1"));
输出结果:
A23 B23 Ccc2123 1