<script language="JavaScript"> var array_1 = new Array('a','b','c','d'); var array_2 = new Array('x','y','z'); document.write( array_1.concat(array_2) ); </script>
运行该例子,输出:
a,b,c,d,x,y,z
下面是数组与具体值连接的例子:
<script language="JavaScript"> var array_1 = new Array('a','b','c','d'); document.write( array_1.concat('xyz',123) ); </script>
运行该例子,输出:
a,b,c,d,xyz,123