René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

JavaScript: for (i in some_array)

<html>
<head>
  <title>for .. in (javascript)</title>

  <script>

    function print_array() {
      var some_array = new Array();
  
      some_array[0] =  'zero';
      some_array[1] =   'one';
      some_array[2] =   'two';
      some_array[3] = 'three';
      some_array[4] =  'four';
      some_array[5] =  'five';
  
      document.open();
      for (i in some_array) {
        document.writeln(i + " = " + some_array[i] + "<br>");
      }
      document.close();
    }

  </script>
</head>
<body onLoad='print_array()'>
</body>
</html>