var arr = [];
for (let i = 0; i < s.length; i++) {
arr[i] = s[i];
}
function to_int(x){
return x*1;
console.log(arr.map(to_int));
return arr.map(to_int).reduce(function (x, y) {
return 10 * x + y;
});
你这个x*1可以的话,我直接 return s*1 测试也可以通过
我的天呐,测试框就在上面,你都不会自己试试吗
talk is cheap,show me your code
Sign in to make a reply
Up.
var arr = [];
for (let i = 0; i < s.length; i++) {
arr[i] = s[i];
}
function to_int(x){
return x*1;
}
console.log(arr.map(to_int));
return arr.map(to_int).reduce(function (x, y) {
return 10 * x + y;
});