Skip to content

Instantly share code, notes, and snippets.

@collin
Created October 21, 2008 19:45
Show Gist options
  • Save collin/18396 to your computer and use it in GitHub Desktop.
Save collin/18396 to your computer and use it in GitHub Desktop.
Function.prototype.take = function(n) {
var arry = [];
while(n--) {arry.push(this(n));}
return arry.reverse();
}
function echo(item) { return item; }
//
echo.take(5);
>>> [0, 1, 2, 3, 4]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment