Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var array_chunk = function(array, size) {
- var output = [],
- i = 0,
- n = 0;
- for(item in array) {
- if(i >= size) {
- i = 0;
- n++;
- }
- if(!output[n] || output[n] == 'undefined') {
- output[n] = [];
- }
- output[n][i] = array[item];
- i++;
- }
- return output;
- };
Add Comment
Please, Sign In to add comment