Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Access Individual Elements of an Array</title> </head> <body> <script> var fruits = ["Apple", "Banana", "Mango", "Orange", "Papaya"]; document.write(fruits[0] + "<br>"); // Prints: Apple document.write(fruits[1] + "<br>"); // Prints: Banana document.write(fruits[2] + "<br>"); // Prints: Mango document.write(fruits[fruits.length - 1]); // Prints: Papaya </script> </body> </html>