Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript for Loop Over an Array</title> </head> <body> <script> var fruits = ["Apple", "Banana", "Orange", "Mango", "Pineapple"]; // Loop through the fruits array and display all the values for(var i = 0; i < fruits.length; i++){ document.write("<p>" + fruits[i] + "</p>"); } </script> </body> </html>