js数组和字符串转换
a、数组转字符串
var i, y;
i = new Array(1,2,3)
y = i.join(".");
console.log(y) //输出"1.2.3"
b、字符串转数组
var arr = "元素1,元素2,元素3";
newarr = arr.split(",");
console.log(newarr); //输出 ['元素1','元素2','元素3']
a、数组转字符串
var i, y;
i = new Array(1,2,3)
y = i.join(".");
console.log(y) //输出"1.2.3"
b、字符串转数组
var arr = "元素1,元素2,元素3";
newarr = arr.split(",");
console.log(newarr); //输出 ['元素1','元素2','元素3']