字符串数组快速转为数字数组

355 阅读1分钟

字符串数组快速转为数字数组

let strArr = ["1","2","3"]
strArr.map(Number)  // 结果 [1,2,3]

数字转为字符串则同理 --> 使用 numArr.map(String)