文字数组 - sort()

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