![](/img/trans.png)
[英]JavaScript foreach an array and split them with commas and last one's comma with "and"
[英]Add a comma to the array but the last one.
当我向用户打印输出时,我目前正在使用此方法在数组的元素中添加逗号。
totalCity + = totalCity +“,”
如何使其添加到数组中除最后一个元素之外的所有元素?
目前,如果我有这个
abc
它添加了a,b,c,
我希望它成为a,b,c
谢谢您的帮助
["you","can","simply","join","them!"].join(", ");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.