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