运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Arrays</h1> <h2>The concat() Method</h2> <p>The concat() method merges (concatenates) arrays:</p> <p id="demo"></p> <script> const array1 = ["Cecilie", "Lone"]; const array2 = ["Emil", "Tobias", "Linus"]; const array3 = ["Robin", "Morgan"]; const myChildren = array1.concat(array2, array3); document.getElementById("demo").innerHTML = myChildren; </script> </body> </html>