将字符串拆分为数组

使用 .split 从字符串转到拆分子字符串的数组:

var s = "one, two, three, four, five"
s.split(", ");  // ["one", "two", "three", "four", "five"]

使用数组方法 .join 返回字符串:

s.split(", ").join("--");  // "one--two--three--four--five"