I've this array of strings which all are numbers
var a = ['11', '15', '16', '17'];
Expected output:
b = [11, 15, 16, 17];
I've this array of strings which all are numbers
var a = ['11', '15', '16', '17'];
Expected output:
b = [11, 15, 16, 17];
var a = ['11', '15', '16', '17'];
var b = a.map(Number);
console.log(b);
You can use a loop, and convert each element of the array containing string, into a integer. parseInt() is a method which converts string into a integer, it takes two arguments, first: the string, second: the base number of the integer
var a=["1","2","3"];
console.log(a);
b=[];
for(i=0;i<3;i++){
b[i]=parseInt(a[i],10)
};
console.log(b)