Concat-1

 

JavaScript Concat function is used to concat two arrays. See the code snippet:

 
 
 
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> </head> <body> <button onclick="joinArrays()">Concatinate the arrays</button> <p id="sample"></p> <script> function joinArrays() { var cars = ["Alto", "Zen"]; var buses = ["Punbus", "PePso", "Linus"]; var result = cars.concat(buses); document.getElementById("sample").innerHTML = result; } </script> </body> </html>
Output