JSFiddle - React, Tailwind, and code Playground
JavaScript
var list = [16, 20, 1,1.5, 3, 0, 4, 6, 8, 9, 22, 18, 14, 13, 12, 100], i
result = [];
// considering ranges `1-4, 5-8, 9-12, 13-16, 17-20, 21-24`
for (i = 1; i < 24; i+= 6) {
result.push(list.filter(function(d){
return ((i+6 > d) && d >= i); // check if the number between lower and upper bound
}));
}
console.log(result);