Skip to content

Instantly share code, notes, and snippets.

@torsday
Last active December 21, 2015 09:29
Show Gist options
  • Select an option

  • Save torsday/6285408 to your computer and use it in GitHub Desktop.

Select an option

Save torsday/6285408 to your computer and use it in GitHub Desktop.
Implemented 'last' functionality to an array in js #js #snippets
// returns a single element of an array based upon it's offset from the end
if (!Array.prototype.last){
Array.prototype.last = function(offset){
return this[this.length - offset];
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment