Skip to content

Instantly share code, notes, and snippets.

@wizard04wsu
Created February 5, 2014 15:56
Show Gist options
  • Save wizard04wsu/8826715 to your computer and use it in GitHub Desktop.
Save wizard04wsu/8826715 to your computer and use it in GitHub Desktop.
Get the maximum and minimum values in an array.
//get max value in an array
//got this from http://addictedtonew.com/archives/482/javascript-array-max-and-equal-height-columns/
if(!Array.prototype.max) Array.prototype.max = function max(){ return Math.max.apply({}, this); };
//get minimum value in an array
if(!Array.prototype.min) Array.prototype.min = function min(){ return Math.min.apply({}, this); };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment