Discuss / JavaScript / 交作业

交作业

Topic source

BROMA丶

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

1:

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

2:

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

3:

return arr.map(x => x[0].toUpperCase()+x.substring(1).toLowerCase());

4:

//方法1
r = arr.map(Number);
//方法2
r = arr.map(str => parseInt(str));

牛啊,第二个太赞了!


  • 1

Reply