跳到主要内容
第6页,共6页
编辑的正文
亚历杭德罗
  • 2.8万
  • 1
  • 18
  • 25

对于另一种情况,我需要它将第一个字母大写,其余字母小写。以下情况使我更改了此函数:

//电子系统5函数大写(字符串){return string.charAt(0).toUpperCase()+string.slice(1).toLowerCase(;}大写(“alfredo”)//=>“alfredo“大写(“Alejandro”)//=>“Alejandero大写(“ALBERTO”)//=>“ALBERTO”大写(“ArMaNdO”)//=>“ArMaNdO”//es6使用破坏const capitalie=([first,…rest])=>first.toUpperCase()+rest.join(“”).toLowerBase();
亚历杭德罗
  • 2.8万
  • 1
  • 18
  • 25