title: how to add values to an array of objects dynamically in javascript?
body: <p>this is an array of objects,</p>
  
  <pre><code>var data = [
        {"label" : "1", "value" : 12},
        {"label" : "1", "value" : 12},
        {"label" : "1", "value" : 12},
        {"label" : "1", "value" : 12}
      ];
  </code></pre>
  
  <p>how can i add values to these dynamically? i tried the below code but no success</p>
  
  <pre><code>var lab =["1","2","3", "4"];
  var val = [42,55,51,22];
  var data = new Array();
  for(var i=0; i&lt;4; i++){
     data[i].label = lab[i];
     data[i].value = val[i];    
  }
  </code></pre>
  
  <p>anyone please..
  thanks in advance</p>