<分区>
我有一个包含数组的字符串:
"[one, two, three]"
我想把它变成一个字符串数组,像这样:
["one", "two", "three"]
如有任何帮助,我们将不胜感激!
更新: 谢谢大家的帮助,你可以在这里看到这个结果: http://kittykatattack.github.io/storymaker/
<分区>
我有一个包含数组的字符串:
"[one, two, three]"
我想把它变成一个字符串数组,像这样:
["one", "two", "three"]
如有任何帮助,我们将不胜感激!
更新: 谢谢大家的帮助,你可以在这里看到这个结果: http://kittykatattack.github.io/storymaker/
最佳答案
试试这个:
'[one, two, three]'.match(/\w+/g);
关于javascript - 将字符串数组更改为字符串数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20052472/