Answers for "how to convert string array to number in javascript"

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
2

js convert number array to string array

/* You can use map and pass the String constructor as a function, 
	which will turn each number into a string: */
sphValues.map(String) //=> ['1','2','3','4','5']
Posted by: Guest on August-30-2021

Code answers related to "how to convert string array to number in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language