I have a single dimension array of objects:
var myArray = [ { record : "value" ,
recod2 : "value" ,
record3 : "value"
} ,
{ record : "value" ,
record2 : "value"
record3 : "value"
} ,
.
.
.
] ;
From this, I want to construct a jagged 2-dimensional array (array of arrays) like so:
var result = [ [ {} , {} , {} , {} ] ,
[ {} , {} , {} , {} ] ,
[ {} , {} , {} , {} ] ,
.
.
.
] ;
For example, If my first array contains 8 objects, The result array should look like this:
var result = [ [ obj1 , obj2 , obj3 , obj4 ] ,
[ obj5 , obj6 , obj7 , obj8 ] ,
] ;
How can I achieve this with a for loop ?