I have an array called targetPercentage.
targetPercentage = [0,33,77,132]
How do I bin it into chunks of length 2 but include the previous value? If possible could also make it into a Javascript object array with its respective properties.
Example output :
[0,33]
[33,77]
[77,132]
Example output by making it into an array of objects :
thresholds : [ {from:0,to:33},{from:33,to:77},{from:77,to:132} ]
Something similar to this question but inclusive of the previous value.