I currently have an array named targetPercentage.
targetPercentage = [0,33,77,132]
Is there a way to divide it into chunks of size 2 while also including the previous value? Additionally, is it possible to convert it into a JavaScript object array with corresponding properties?
Here's an example of the desired output:
[0,33]
[33,77]
[77,132]
Here's an example of converting it into an array of objects:
thresholds : [ {from:0,to:33},{from:33,to:77},{from:77,to:132} ]
I'm looking for a solution similar to this question but with the inclusion of the previous value.