Discuss / JavaScript / 练习1,2,3

练习1,2,3

Topic source

梨花菜

#1 Created at ... [Delete] [Delete and Lock User]

`reduce` 求乘积

 return arr.reduce((x,y) => x*y)

string2int

return s.split('').map(x => x*1).reduce((x,y) => x*10 + y)

首字母大写

arr.map(s => s[0].toUpperCase() + s.slice(1).toLowerCase())

  • 1

Reply