In javascript, how to split an array into chunks by breaks? For example,
var array = [0,1,2,3,4,5,6,7,8,9,12,13,15,20]
var breaks = [0,3.5,13]
somefunction(array, breaks) === [[0,1,2,3],[4,5,6,7,8,9,12],[13,15,20]]
// true
The value in breaks does not necessarily in the array.
breaksis referring to values not indices. Why does4get put in the second bin based on a4.5break? That would indicate to me that4should go into the first bin.