用数组的元素组成字符串 - join()

  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. document.write(arr.join());
  12.  
  13. document.write("<br />");
  14.  
  15. document.write(arr.join("."));
  16.  
  17. </script>
  18.  
  19. </body>
  20. </html>