I am currently working on a Node.js program that has a similar structure to the following:
var foo = [val,val,val....]
var bar = []
for(i=0;i<foo.length;i++){
bar.push(foo[i])
if(bar.length % 29 == 0){
//do something with items 1-29 of bar
bar.length = 0;
}
}
The foo array contains over 1,000 items and I need to execute a specific function for every set of 29 items within it. I am using the bar array to successfully capture each set of 29 items and reset it once the function is performed. However - I am looking for guidance on how to handle the last remaining items in the foo array that are less than 29.
If anyone has suggestions or tips on how I can approach this issue, it would be greatly appreciated.