將字串拆分為陣列

使用 .split 從字串轉到拆分子字串的陣列:

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

使用陣列方法 .join 返回字串:

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