Access object's member in array forEach function or for iteration - Javascript Array

Javascript examples for Array:forEach

Description

Access object's member in array forEach function or for iteration

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  w w  w. j  a  v a  2s.  c  o m
var numArray = [{1:1},{2:2}];
numArray.forEach(function(value,index){
    console.log(value,index,this);//{1:1},0 window
});
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials