Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Arrays</h1> <h2>The concat() Method</h2> <p>The concat() method can merge string values to arrays:</p> <p id="demo"></p> <script> const myArray = ["Emil", "Tobias", "Linus"]; const myChildren = myArray.concat("Peter"); document.getElementById("demo").innerHTML = myChildren; </script> </body> </html>