源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>享学课堂</title> </head> <body> <h1>连接两个数组</h1> <p id="demo"></p> <script> var myGirls = ["Cecilie", "Lone"]; var myBoys = ["Emil", "Tobias", "Linus"]; var myChildren = myGirls.concat(myBoys); document.getElementById("demo").innerHTML = myChildren; </script> </body> </html>
运行结果