Skip to content

Instantly share code, notes, and snippets.

@royriojas
Created April 18, 2014 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save royriojas/11068334 to your computer and use it in GitHub Desktop.
Save royriojas/11068334 to your computer and use it in GitHub Desktop.
var splitArray = function (origin, chunkSize ) {
origin = origin || [];
var arr = [];
for ( var i = 0, len = origin.length; i < len; i += chunkSize ) {
arr.push( origin.slice( i, i + chunkSize ));
}
return arr;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment