1var a = "1,2,3,4";
2
3var b = a.split(',').map(function(item) {
4 return parseInt(item, 10);
5});
1const toNumbers = arr => arr.map(Number);
2toNumbers(['1', '2', '3','4']); // [1, 2, 3, 4]
1// CONVERT ARRAY STRING TO ARRAY NUMBER
2const arrStr = ["1", "3", "5", "9"];
3const nuevo = arrStr.map((i) => Number(i));
4console.log(nuevo);
5// [1,3,5,9];