use the length number from array? - Javascript Array Operation

Javascript examples for Array Operation:Array Element

Description

use the length number from array?

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from ww  w  .  ja  v  a2  s .  c om*/
var div = document.getElementById('i');
var map = [
  [3, 0, 0, 2],
  [1, 6, 6, 8],
  [2, 6, 6, 8],
  [5, 1, 1, 4]
];
var i = map.length;
var j = map[i-1].length;
div.innerHTML = div.innerHTML + i;
div.innerHTML = div.innerHTML + j;
    }

      </script> 
   </head> 
   <body> 
      <div id="i"></div> 
      <div id="j"></div>  
   </body>
</html>

Related Tutorials