var arr =[1,2,3,4,5,6,7,8] const bucket = new Array(arr.length + 1).fill() .map(() => []); /** [ [], [], [], [], [], [], [], [], [] ] **/