W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <h1>JavaScript 数组方法</h1> <h2>concat()</h2> <p>concat() 方法也可以将值合并到数组:</p> <p id="demo"></p> <script> var arr1 = ["Emma", "Isabella"]; var myChildren = arr1.concat(["Jacob", "Michael", "Ethan"]); document.getElementById("demo").innerHTML = myChildren; </script> </body> </html>