连接三个数组 - concat()
- <!DOCTYPE html>
- <html>
- <body>
- <h1>JavaScript 数组方法</h1>
- <h2>concat()</h2>
- <p>concat() 方法用于合并(连接)数组:</p>
- <p id="demo"></p>
- <script>
- var arr1 = ["Emma", "Isabella"];
- var arr2 = ["Jacob", "Michael", "Ethan"];
- var arr3 = ["Joshua", "Daniel"];
- var myChildren = arr1.concat(arr2, arr3);
- document.getElementById("demo").innerHTML = myChildren;
- </script>
- </body>
- </html>