Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Add Multiple elements to an Array At Once</title> </head> <body> <script> var colors = ["Red", "Green", "Blue"]; colors.push("Pink", "Voilet"); colors.unshift("Yellow", "Grey"); document.write(colors + "<br>"); // Prints: Yellow,Grey,Red,Green,Blue,Pink,Voilet document.write(colors.length); // Prints: 7 </script> </body> </html>