Below is a collection of objects:
var items = [
{"label" : "1", "value" : 12},
{"label" : "2", "value" : 15},
{"label" : "3", "value" : 20},
{"label" : "4", "value" : 25}
];
I am looking for a way to dynamically add values to this array. I attempted the code below without success:
var labels =["1","2","3", "4"];
var values = [42,55,51,22];
var newData = new Array();
for(var i=0; i<4; i++){
newData[i].label = labels[i];
newData[i].value = values[i];
}