There can be multiple approach to solve this but I am not sure why this one specifically is not working as expected.
[1,2,3,4,5,6,7,8].reduce((a, d, i, c) => [...a, c.splice(0, 3)], [])
Result - [[1,2,3], [4,5,6]]
Expected Result - [[1,2,3], [4,5,6], [7,8]]
Please do not change the approach as I want to know why this one is not working as expected.