1.数组转字符串
let list = [1,2,3,4,5,6]; list.join(","); console.log(list); // 打印结果:"1,2,3,4,5,6"
2.字符串转数组
var text = "1,2,3,4,5"; var array = text.split(",");//逗号是分隔符 var array = text.replace(/\"/g, "");
1.数组转字符串
let list = [1,2,3,4,5,6]; list.join(","); console.log(list); // 打印结果:"1,2,3,4,5,6"
2.字符串转数组
var text = "1,2,3,4,5"; var array = text.split(",");//逗号是分隔符 var array = text.replace(/\"/g, "");