Javascript examples for Language Basics:Introduction
You enumerate the content of an array using a for loop.
<!DOCTYPE HTML> <html> <head> <title>Example</title> </head> <body> <script type="text/javascript"> var myArray = [100, "java2s.com", true]; for (var i = 0; i < myArray.length; i++) { document.writeln("Index " + i + ": " + myArray[i]); }/*from w ww .j ava2 s . c om*/ </script> </body> </html>