方式一
let arr = ['1','2','3','4','5'];
let mapArr = arr.map(Number);
console.log(mapArr);
方式二
let arr = ['1','2','3','4','5'];
let mapArr = arr.map(str => parseInt(str));
console.log(mapArr);
方式三
let arr = ['1','2','3','4','5'];
function returnInt(e){
return parseInt(e,10);
}
let mapArr = arr.map(returnInt);
console.log(mapArr);