Reputation: 125
I add JSON objects to an array using push command. After adding that array shows only two JSON objects. Then I add the whole array to another array that contains 7 other arrays. Finally, when I access the JSON object array it shows two JSON objects and one additional array that contain same objects and the array. Here I attached the code and result of the outcome. How can I resolve this?
prevArrhythBeats.push(
{
x: annotationPacket[k].timestamp,
title: annotationPacket[k].annotBeat.a_type,
text: annotationPacket[k].annotBeat.a_desc
}
);
dataFactory.setPrevData(prevChOne, prevChTwo, prevGrid, prevLeadChange, prevMotion, prevArrhythBeats)
dataFactory.setPrevData = function (cOne, cTwo, grid, lead, mot, beat) {
prevData.push(cOne);
prevData.push(cTwo);
prevData.push(grid);
prevData.push(lead);
prevData.push(mot);
prevData.push(beat);
}
before add to dataFactory.setPrevData
After dataFactory.setPrevData method
Upvotes: 3
Views: 53