Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Remove the First Element from an Array</title> </head> <body> <script> var colors = ["Red", "Green", "Blue"]; var first = colors.shift(); document.write(first + "<br>"); // Prints: Red document.write(colors.length); // Prints: 2 </script> </body> </html>