i have obj of array
var data = [{
value: 1,
t: 1487203500000
}, {
value: 2,
t: 1487213700000
}];
here, i need to compare t obj at inside a loop, if it is exceeds 5 mins, then i need to create a one item with value of null and append into that array.
Expected result will be
var data = [{
value: 1,
t: 1487203500000
}, {
value: null,
t: null
} {
value: 2,
t: 1487213700000
}];
while appending i need to push into same index and existing value should be readjusted.
data[0]["t"]to? Because obviously all of them exceed 5minutes (by years). Do you want to compare one item to the next, likedata[1]["t"] - data[0]["t"] > 5 * 60 * 1000, and if so, insert thenullobject between them, sodata[1]becomesdata[2]?