Last active
August 29, 2015 14:06
-
-
Save obenjiro/888352066919f87a52f8 to your computer and use it in GitHub Desktop.
Shortest Chunk implementation
This file contains 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 | |
function chunk(arr, n) { | |
var result = []; | |
while(arr.length) { | |
result.push(arr.splice(0,n)) | |
} | |
return result; | |
} | |
//chunk - obfuscated (72 chars) | |
function chunk(n,u,r){for(r=[];n.length;)r.push(n.splice(0,u)) | |
return r} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment