I have a type String
that looks like '["123", 123, "testing"]'
.
How do I change that String
into type Array
?
I have a type String
that looks like '["123", 123, "testing"]'
.
How do I change that String
into type Array
?
You can use JSON.parse
. See example below:
var str = '["123", 123, "testing"]';
var strArray = JSON.parse(str);
console.log(strArray);
for(var i = 0; i < strArray.length; i++) {
console.log(strArray[i]);
}