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