Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Loop Through an Array Using For Loop</title> </head> <body> <script> var fruits = ["Apple", "Banana", "Mango", "Orange", "Papaya"]; // Iterates over array elements for(var i = 0; i < fruits.length; i++){ document.write(fruits[i] + "<br>"); // Print array element } </script> </body> </html>