Editor Arrow Download Open
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>JavaScript array while loop</title> </head> <body> <pre> <!-- Use pre element for work document.writeln() method --> <script> var arr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]; number = 0; while (number < arr.length) { document.writeln("Value of arr[" + number + "] : " + arr[number]); number++; } document.writeln("End of Loop."); </script> </pre> </body> </html>
  Preview Arrow