Skip to content

Instantly share code, notes, and snippets.

@sidonath
Created June 8, 2010 17:46
Show Gist options
  • Select an option

  • Save sidonath/430390 to your computer and use it in GitHub Desktop.

Select an option

Save sidonath/430390 to your computer and use it in GitHub Desktop.
Array.prototype.min = Math.min;
function smallest(array){
return array.min;
}
function largest(array){
return Math.max.apply( Math, array );
}
assert(smallest([0, 1, 2, 3]) == 0, "Locate the smallest value.");
assert(largest([0, 1, 2, 3]) == 3, "Locate the largest value.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment