As a newcomer to javascript, I am looking to group every 3 elements in an array and save them as subarrays within another array. Below is an example:
var a = [11, 2, 3, 4, 5, 6, 7, 8, 9, 2, 2, 3, 4, 5, 4];
The desired output would be:
var arrays = [[11, 2, 3], [4, 5, 6], [7, 8, 9], [2, 2, 3], [4, 5, 4]];
In my specific project context, I have an array with 73 objects that I'd like to organize in a similar manner.
var objects = [{}, {}, {}], [{}, {}, {}], ...]
I wonder if there would be any difficulties arising from the fact that 73 is not evenly divisible by three.