Answers for "convert an array of strings to 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
10

javascript Convert an array of strings to numbers

const toNumbers = arr => arr.map(Number);
toNumbers(['1', '2', '3','4']);     // [1, 2, 3, 4]
Posted by: Guest on July-02-2020

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

Code answers related to "Javascript"

Browse Popular Code Answers by Language