Let's say I have an array like this:
public taskListCustom: any=[
{title: 'Task 1', status: 'done'},
{title: 'Task 2', status: 'done'},
{title: 'Task 3', status: 'done'},
{title: 'Task 4', status: 'done'},
{title: 'Task 5', status: 'done'},
{title: 'Task 6', status: 'done'},
{title: 'Task 7', status: 'done'},
{title: 'Task 8', status: 'done'},
{title: 'Task 9', status: 'done'},
{title: 'Task 10', status: 'done'},
{title: 'Task 11', status: 'done'},
{title: 'Task 12', status: 'done'},
{title: 'Task 13', status: 'done'},
{title: 'Task 14', status: 'done'},
{title: 'Task 15', status: 'done'},
{title: 'Task 16', status: 'done'},
{title: 'Task 17', status: 'done'},
{title: 'Task 18', status: 'done'},
{title: 'Task 19', status: 'done'},
{title: 'Task 20', status: 'done'},
{title: 'Task 21', status: 'done'},
{title: 'Task 22', status: 'done'},
{title: 'Task 23', status: 'done'},
{title: 'Task 24', status: 'done'},
]
In addition, I have an empty array called
public taskListCustomChunked: any=[];
My objective is to divide the taskListCustom array into smaller arrays based on a specified chunk size. For instance, if the chunk size is 6 (which can range from 4 to 11), I need to create 6 chunks of equal size and store them in the taskListCustomChunked array. This would result in something like:
taskListCustomChunked = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16],[..],[..]]
How can I achieve this?