How to converf string element of string to array integer in javascript

How to convert string element of string to array integer in javascript.

I have string like this

var str = "["163600", "163601", "166881"]";

my output should be = [163600, 163601, 166881]

What I am trying is

var myArr = JSON.parse(str)

but in result I am getting array of string.

["163600", "163601", "166881"]

How can I get of array of Integer.

I am trying to further parsing like this

parseInt(myArr) but this is giving only for 0th index. Is there anyway to get for whole array.

38 thoughts on “How to converf string element of string to array integer in javascript”

Leave a Comment