Im receiving from an API something like this
"['item1', 'item2', 'item3']"
so even though it looks like an array is actually a string. I want to convert that to an array again so I did this.
let pseudoArray = "['item1', 'item2', 'item3']";
let actualArray = pseudoArray.slice(1, -1).split(', ');
And it kinda works I just remove the brackets at the beginning and the end with slice() and use split to separate by the comma into an actual array.
But I feel this is not the best way to do it, is there a better, cleaner way to parse this string into an array?