String Array ke Number Array JavaScript
const stringArr = ["5", "4", "6", "2"];
const numArr = stringArr.map((item) => parseInt(item, 10));
Inquisitive Iguana
const stringArr = ["5", "4", "6", "2"];
const numArr = stringArr.map((item) => parseInt(item, 10));
const atrArr = ['7', '2', '5']
let numbersArr = strArr.map(c => +c); //[7, 2, 5]
/* 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']