title: how to get the key value from the json data in the loop and push it another varibale in JavaScript + angularjs
body: <blockquote>
    <p>Hi i do have a less knowledge in javascript i need to get the key
    value from the json data and i need to be store in varibale because i
    need to be push the values in the grid.</p>
  </blockquote>
  
  <pre><code>var invertor =[{
      "InvId": "1",
      "InvDt": "20170220",
      "LastReading": "0",
      "ReadReading": "0"
    },
    {
      "InvId": "1",
      "InvDt": "20170221",
      "LastReading": "0",
      "ReadReading": "12"
    },
    {
      "InvId": "4",
      "InvDt": "20170221",
      "LastReading": "12",
      "ReadReading": "25"
    }];
  
  this is my json data from here i need to get LastReading and ReadReading value in the second loop beacuse i need to push my data to grid
  
  var tabledata=[];
   var inventordata=[];
   for(var i=0;i&lt;invertor.length;i++){
      debugger
    var tdata={
     "heading":"InvId: "+i,
     "Date":"Date :"+i
    }
    tabledata.push(tdata);
   }
   $scope.tablearray=tabledata;
  
  
  
  
  in this loop i need to get LastReading and ReadReading values to push in the grid
  
  
    for(var i=0;i&lt;6;i++){
    var tdata={
     "Last":"invertor.Last: "+i,
     "Read":"invertor.Read: "+i
    }
    inventordata.push(tdata);
   }
   $scope.inventorarray=inventordata;
  </code></pre>
  
  <p>my html Code is here</p>
  
  <pre><code>   &lt;tr&gt;
        &lt;td&gt;Date&lt;/td&gt;
        &lt;td ng-repeat="data in inventorarray"&gt; &lt;p ng-if="$index%2==0"&gt; Last Reading&lt;/p&gt;&lt;p ng-if="$index%2&gt;0"&gt; Read By&lt;/p&gt; &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr  ng-repeat="data in tablearray"&gt; 
        &lt;td&gt; {{data.Date}}&lt;/td&gt;
         &lt;td ng-repeat="data in inventorarray"&gt; &lt;p ng-if="$index%2==0"&gt; {{data.Last}}&lt;/p&gt;&lt;p ng-if="$index%2&gt;0"&gt;{{data.Read}}&lt;/p&gt; &lt;/td&gt;
                       &lt;/tr&gt;
  </code></pre>
  
  <blockquote>
    <p>those values which im getting i need to be push here.<a href="https://i.stack.imgur.com/sienq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sienq.png" alt="enter image description here"></a></p>
  </blockquote>