JS中字符串与数组的转换,类似PHP的explode implode 。
js 数组转字符串 join
var a = new Array(1, 2, 3, 4, 5, 6); var b = a.join(","); alert(b);
js 字符串转数组 split
var a = "1,2,3,4,5,6"; var b = new Array(); b = a.split(","); alert(typeof b); alert(b);