var arr = [1, 2, 3, 4]; var arr2 = arr; var str = arr.toString(); // 将数组转换为字符串 console.log(str); // 1,2,3,4
var str2 = arr2.join("|");//按照键入字符将数组转换为字符串 console.log(str2);
标签:arr,转换,数组,str2,var,str,字符串
来源: https://www.cnblogs.com/czb1218/p/16656928.html