How to use Array.map() to convert array string digits elements to integers in JavaScript

1 Answer

0 votes
var arr = ['1', '2', '3', '4', '5'];

var arr_int = arr.map(Number);

console.log(arr_int); 
 
 
/*
run:  
  
 [1, 2, 3, 4, 5]
   
*/

 



answered May 22, 2016 by avibootz
...