justsink
justsink
发布于 2个月前

JS中字符串与数组的转换,类似PHP的explode

数组转字符串:

var a=new Array(1,2,3,4,5,6);
var b=a.join(",");
console.log(b);

字符串转数组:

var a="1,2,3,4,5,6";
var b=new Array();
b=a.split(",");
console.log(b);