如何使用逗号将字符串数组转换为CSV字符串?

时间:2019-03-26 21:55:30

标签: javascript

我有一个字符串数组

["Ann", "David", "Ben"]

如何在javascript中转换为CSV字符串?

"Ann, David, Ben"

1 个答案:

答案 0 :(得分:0)

join()将为您完成。参见:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join

a=["Ann", "David", "Ben"]

a.join()
"Ann,David,Ben"