跳到主要内容
分享您的体验:参加2024年开发商调查
正文中添加了288个字符
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357

最短3个解决方案,1个和2个处理案例字符串是"",无效的未定义的:

s&&s[0].toUpperCase()+s.slice(1)//32字符s&&s.replace(/./,s[0].toUpperCase())//36字符-使用regexp'foo'.replace(/./,x=>x.toUpperCase())//31 char-字符串上的直接字符,ES6

对于s='oo-bar',我们得到

让s=“oo bar”;控制台.log(s&&s[0].toUpperCase()+s.slice(1));console.log(s&&s.replace(/./,s[0].toUpperCase()));console.log(“foo bar”.replace(/./,x=>x.toUpperCase()));
“Foo酒吧”
 

最短3个解决方案,1个和2个处理案例字符串是"",无效的未定义的:

s&&s[0].toUpperCase()+s.slice(1)//32字符s&&s.replace(/./,s[0].toUpperCase())//36字符-使用regexp'foo'.replace(/./,x=>x.toUpperCase())//31 char-字符串上的直接字符,ES6

对于s='oo-bar',我们得到

“Foo酒吧”

最短3个解决方案,1个和2个处理案例字符串是"",无效的未定义的:

s&&s[0].toUpperCase()+s.slice(1)//32字符s&&s.replace(/./,s[0].toUpperCase())//36字符-使用regexp'foo'.replace(/./,x=>x.toUpperCase())//31 char-字符串上的直接字符,ES6

让s=“oo bar”;控制台.log(s&&s[0].toUpperCase()+s.slice(1));console.log(s&&s.replace(/./,s[0].toUpperCase()));console.log(“foo bar”.replace(/./,x=>x.toUpperCase()));
 

在正文中添加了7个字符
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357

最短3个解决方案,1个和2个处理案例 一串 "",无效的未定义的:

s&&s[0].toUpperCase()+s.slice(1)//32字符s&&s.replace(/./,s[0].toUpperCase())//36字符-使用regexp'foo'.replace(/./,x=>x.toUpperCase())//3631char-直接在字符串上,ES6

对于s=“oo bar”我们得到

“Foo酒吧”

最短3种解决方案,1种和2种解决方案 "",无效的未定义的:

s&&s[0].toUpperCase()+s.slice(1)//32字符s&&s.replace(/./,s[0].toUpperCase())//36字符-使用regexp“foo”.replace(/./,x=>x.toUpperCase())//36char-直接,ES6

对于s=“oo bar”

“Foo酒吧”

最短3个解决方案,1个和2个处理案例 一串 "",无效的未定义的:

s&&s[0].toUpperCase()+s.slice(1)//32字符s&&s.replace(/./,s[0].toUpperCase())//36字符-使用regexp'foo'.replace(/./,x=>x.toUpperCase())//31char-直接在字符串上,ES6

对于s=“oo bar”我们得到

“Foo酒吧”
编辑的正文
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357

最短3种解决方案哪一个、1和2处理字符串为"",无效的未定义的:

  • s&&s[0].toUpperCase()+s.slice(1)//32字符

  • s&&s.replace(/./,s[0].toUpperCase())//36字符-使用regexp

  • 'foo'.replace(/./,x=>x.toUpperCase())//36 char-直接

s&&s[0].toUpperCase()+s.slice(1)//32字符s&&s.replace(/./,s[0].toUpperCase())//36字符-使用regexp'foo'.replace(/./,x=>x.toUpperCase())//36 char-直接,ES6

对于s=“oo bar”

“Foo酒吧”

最短3种解决方案哪一个处理字符串为"",无效的未定义的:

  • s&&s[0].toUpperCase()+s.slice(1)//32字符

  • s&&s.replace(/./,s[0].toUpperCase())//36字符-使用regexp

  • 'foo'.replace(/./,x=>x.toUpperCase())//36 char-直接

对于s=“oo bar”

“Foo酒吧”

最短3种解决方案、1和2处理字符串为"",无效的未定义的:

s&&s[0].toUpperCase()+s.slice(1)//32字符s&&s.replace(/./,s[0].toUpperCase())//36字符-使用regexp'foo'.replace(/./,x=>x.toUpperCase())//36字符-直接,ES6

对于s=“oo bar”

“Foo酒吧”
编辑的正文
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357
加载
在正文中添加了93个字符
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357
加载
删除正文中的2个字符
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357
加载
删除正文中的2个字符
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357
加载
正文中添加了19个字符
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357
加载
删除了正文中的48个字符
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357
加载
正文中添加了19个字符
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357
加载
删除正文中的3个字符
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357
加载
删除正文中的1个字符
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357
加载
在正文中添加了4个字符
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357
加载
正文中添加了17个字符
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357
加载
编辑的正文
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357
加载
删除正文中的1个字符
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357
加载
正文中添加了13个字符
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357
加载
正文中添加了6个字符
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357
加载
正文中添加了6个字符
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357
加载
正文中添加了6个字符
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357
加载
来源 链接
卡米尔·基耶夫斯基
  • 89.5公里
  • 31
  • 381
  • 357
加载