js字符数组转化为数字数组

['1','2','3'] => [1,2,3]

 

 

 

 

['1','2','3'].map(Number) // [1,2,3]

['1','2','3'].map((value)=>{ return parseInt(value) }) // [1,2,3] JSON.parse('[' + String(['1', '2', '3']) + ']') // [1,2,3] eval('[' + String(['1', '2', '3']) + ']') // [1,2,3]

posted on 2019-09-23 17:00  liuhao1992  阅读(3933)  评论(0编辑  收藏  举报

导航