Answers for "convert array of strings to array of numbers"

10

convert an array of strings to numbers

let result = ["1", "2", "3", "4"].map(i=>Number(i));
console.log(result);
Posted by: Guest on February-24-2021
8

how to convert string to int a array in javascript

var a = "1,2,3,4";

var b = a.split(',').map(function(item) {
    return parseInt(item, 10);
});
Posted by: Guest on November-15-2019
1

convert array string to number

// CONVERT ARRAY STRING TO ARRAY NUMBER
const arrStr = ["1", "3", "5", "9"];
const nuevo = arrStr.map((i) => Number(i));
console.log(nuevo);
// [1,3,5,9];
Posted by: Guest on June-09-2020

Code answers related to "convert array of strings to array of numbers"

Code answers related to "Javascript"

Browse Popular Code Answers by Language