Iterate Object Array - Javascript Array Operation

Javascript examples for Array Operation:Array of Object

Description

Iterate Object 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(){// w  w  w  . j a v a2 s .c o m
var obj = [
      {id:"I1", name:"A" , comment:"test 2"},
      {id:"I2", name:"B" , comment:"test 1"},
      {id:"I3", name:"C" , comment:"test"},
    ]
    obj.forEach(function(item){
       console.log(item.id, item.name);
    });
    }

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

Related Tutorials