合并两个数组 - concat()

  1. <html>
  2. <body>
  3.  
  4. <script type="text/javascript">
  5.  
  6. var arr = new Array(3)
  7. arr[0] = "George"
  8. arr[1] = "John"
  9. arr[2] = "Thomas"
  10.  
  11. var arr2 = new Array(3)
  12. arr2[0] = "James"
  13. arr2[1] = "Adrew"
  14. arr2[2] = "Martin"
  15.  
  16. document.write(arr.concat(arr2))
  17.  
  18. </script>
  19.  
  20. </body>
  21. </html>