Arrays & Array Methods (map, filter, reduce)
What array transformation is being performed?
const data = [1, 2, 3, 4, 5];
const chunks = data.reduce((acc, item, index) => {
const chunkIndex = Math.floor(index / 2);
if (!acc[chunkIndex]) acc[chunkIndex] = [];
acc[chunkIndex].push(item);
return acc;
}, []);