I have a method that gets an array in the form of a string like "['123', '245345','2345']"
I want to convert it to an array datatype. Here I want to remove the quotes and want the type to be an array. How can I do it easily in JS?
Input: "['123','234']" // string
output: ['123','234'] //array datatype
3
Answers
You can try as follows
Output:
[‘123’, ‘234’]
Like so:
You could attempt to use
eval()
Will result in your expected output being stored in the local variable
x