-
-
Save CodeMaxter/d3c15a7bd211da118ef72368915133b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* chunk array into specific chunks :) | |
* @param arr | |
* @param len | |
* @returns {Array} | |
*/ | |
function chunkArray(arr, len) { | |
if (!Array.isArray(arr)) return []; | |
let chunks = [], | |
i = 0, | |
arrayLen = arr.length; | |
while (i < n) { | |
chunks.push(arr.slice(i, i += len)); | |
} | |
return chunks; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment