如何在Javascript中加入字符串数组 [英] How to join array of strings in Javascript
本文介绍了如何在Javascript中加入字符串数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将 result = ["July",,","1st"]
的数组加入 result = ["July 1st"]].
想要删除逗号.
I want to join an array of result = ["July"," ","1st"]
into result = ["July 1st"].
I also want to have the comma removed.
我尝试了result.join()和result.join(,"),但是没有用.实际上,没有任何变化.谁能帮我解决这个问题?谢谢.
I have tried result.join() and result.join(",") but it didn't work. In fact, nothing changes. Can anyone help me to solve this problem? Thanks.
推荐答案
您只需要将其加入并放入数组中即可:
You just need to join it and put into an array...:
result = [result.join('')];
这篇关于如何在Javascript中加入字符串数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文