1、return arr.reduce(function(x,y){ return x* y });
2、return s.split("").map(function(x){return x*1}).reduce(function(x,y){return x*10+y});
3、return arr.map((x)=>(x.toLowerCase().replace(x[0].toLowerCase(),x[0].toUpperCase())));
4、r = arr.map(x=>parseInt(x));
抄一波作业
看差了 replace 看出来 reduce
废话太多了@🌙
想问一下 第三个 最后面那个括号里面的x[0].toLowerCase() 的toLowerCase()省略后会出错呢?
你在本地vscode里打印一下item你就知道了@
Sign in to make a reply
好耶
1、return arr.reduce(function(x,y){ return x* y });
2、return s.split("").map(function(x){return x*1}).reduce(function(x,y){return x*10+y});
3、return arr.map((x)=>(x.toLowerCase().replace(x[0].toLowerCase(),x[0].toUpperCase())));
4、r = arr.map(x=>parseInt(x));