这样可以吗
来源:3-31 编程练习
大脸猫大脸猫喵喵喵
2017-10-24 11:07:52
function demo(str){
var arr=str.split(" "),newstr="";
//console.log(arr);
for(var i=0;i<arr.length;i++){
var word=arr[i]+" ";
newstr+=word.charAt(0).toUpperCase()+word.substr(1);
//console.log(newstr);
}
return newstr;
}
var cameFormat=demo("all time is no time when it is past")
console.log(cameFormat);2回答
效果实现的没有问题!
祝学习愉快!
小丸子爱吃菜
2018-02-01
在这里分号加不加都不影响效果的,如果按照标准的语法来说,加上分号更规范。
相似问题