[英]Add single quotes in a string array javascript
I been searching for the solution but can find it...我一直在寻找解决方案,但可以找到它......
I have the following array with the following output:我有以下数组,其中包含以下 output:
['Fruits, Cars, Clothes, Shoes'] ['水果、汽车、衣服、鞋子']
But I need the that array to output the following:但我需要该数组到 output 以下:
['Fruits', 'Cars', 'Clothes', 'Shoes'] ['水果','汽车','衣服','鞋子']
I already tried the following and it did not work:我已经尝试了以下方法,但没有奏效:
var output= arr.map(item => "'" + item + "'").join(); var output= arr.map(item => "'" + item + "'").join();
Can you help please你能帮忙吗
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.