Skip to content

Instantly share code, notes, and snippets.

@odderlynat
Last active December 14, 2015 07:19
Show Gist options
  • Save odderlynat/5049539 to your computer and use it in GitHub Desktop.
Save odderlynat/5049539 to your computer and use it in GitHub Desktop.
Working on some ideas for array synatic sugar in Javascript.
(function(){
Array.prototype.first = function() {
return this[0];
};
Array.prototype.last = function() {
return this[this.length - 1];
};
Array.prototype.skip = function(num) {
return this.slice(num,this.length);
};
Array.prototype.take = function(num) {
return this.slice(0,num);
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment