1.數組 轉 字符串
var a, b;
a = new Array('a','b','c','d','e');
b = a.join("-");
document.write(b);
document.write(typeof a);
document.write(typeof b);
<span style="font-family: Verdana, Arial, 宋體; line-height: 18px; background-color: rgb(249, 249, 249);">join() 方法用於把數組中的所有元素放入一個字符串。</span>
2.字符串 轉 數組
var s = "abc,abcd,aaa";
ss = s.split(",");// 在每個逗號(,)處進行分解。
document.write(ss);
document.write(typeof ss);
document.write(typeof s);
<span style="font-family: Verdana, Arial, 宋體; line-height: 18px; background-color: rgb(249, 249, 249);">split() 方法用於把一個字符串分割成字符串數組。</span>