发布于 5年前

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);
©2020 edoou.com   京ICP备16001874号-3