Convert String Array to int Array.
JavaScript Code:
1 2 3 4 5 6 7 8 9 10 |
const arrOfStr = ['1', '2', '3']; const arrOfNum = arrOfStr.map(str => { return Number(str); }); // [1, 2, 3] console.log(arrOfNum); |
Output:
Convert String Array to int Array.
JavaScript Code:
1 2 3 4 5 6 7 8 9 10 |
const arrOfStr = ['1', '2', '3']; const arrOfNum = arrOfStr.map(str => { return Number(str); }); // [1, 2, 3] console.log(arrOfNum); |
Output: