javascript join 数组变字符串

分类:前端技术 | 网络转载 |  时间:2013-10-06

var arr = new Array(4);
arr[0] = "a";
arr[1] = "b";
arr[2] = "c";
arr[3] = "abcd";

alert(arr.toString());  //a,b,c,abcd
alert(arr.join('|'));    //a|b|c|abcd

 

var arr1 = arr.conat("sfdsf","sdfsdf");

alert(arr1);


Copyright © 2013 ZHIZ.NET, INC. ALL RIGHTS RESERVED. TERMS OF SERVICE & PRIVACY POLICY. 1.3.5 蜀ICP备11006209号-2 TEL/18200120015 QQ:297055170