數(shù)組對象的join方法可以把數(shù)組的幾個(gè)元素連接成一個(gè)字符串。
JavaScript代碼
- <script type = "text/javascript">
- var arr = ["HTML","CSS","JavaScript","DOM"];
- </script>
<script type = "text/javascript">var arr = ["HTML","CSS","JavaScript","DOM"];</script>
測試數(shù)組的join方法
- <script type="text/javascript">
- document.write("<p>" + arr.join() + "</p>");
-
- </script>