I have a string that looks like this: '[a, b]' I am looking to create an array that appears as follows: ["a", "b"]
This is the script I came up with:
const str = '[a, b]'
const arr = str.replace('[', '').replace(']', '').replaceAll("'", '').split(',')
console.log(arr)
Although my code resolves the issue at hand, I am curious if there is a more efficient method to achieve the same outcome compared to what I have implemented.