pro-array.js
function(size) {
    size = size || 1;

    var numChunks = Math.ceil(this.length / size);
    var result = new Array(numChunks);

    for (var i = 0, index = 0; i < numChunks; i++) {
      result[i] = chunkSlice(this, index, index += size);
    }

    return result;
  }
function(size) {
    size = size || 1;

    var numChunks = Math.ceil(this.length / size);
    var result = new Array(numChunks);

    for (var i = 0, index = 0; i < numChunks; i++) {
      result[i] = chunkSlice(this, index, index += size);
    }

    return result;
  }
function ( size ) { size = size || 1 ; var numChunks = Math . ceil ( this . length / size ) ; var result = new Array ( numChunks ) ; for ( var i = 0 , index = 0 ; i < numChunks ; i ++ ) { result [ i ] = chunkSlice ( this , index , index += size ) ; } return result ; }
Creates an array of elements split into groups the length of `size`. If the array
can't be split evenly, the final chunk will be the remaining elements.

@function Array#chunk
@param {number} [size=1] - The length of each chunk.
@returns {Array} An array containing the chunks.
@throws {RangeError} Throws when `size` is a negative number.

@example
[1, 2, 3, 4].chunk(2);
// -> [[1, 2], [3, 4]]

[1, 2, 3, 4].chunk(3);
// -> [[1, 2, 3], [4]]
Creates an array of elements split into groups the length of size . If the array can t be split evenly the final chunk will be the remaining elements .