Discuss
/
JavaScript
/
不规范的英文名字,变为首字母大写,其他小写的规范名字
不规范的英文名字,变为首字母大写,其他小写的规范名字
Topic source我的是这种 function normalize(arr) { return arr.map(function(s){ return s.split('').map(function(item,index){ if(index==0){ return item.toUpperCase() }else{ return item.toLowerCase() } }).reduce(function(x,y){ return x+y }) })
- 1
BruceWang_NEU
return (arr.map(function(x){ return x.slice(0,1).toUpperCase() + x.slice(1).toLowerCase(); }));