Skip to content

Instantly share code, notes, and snippets.

@cange
Created August 5, 2010 09:15
Show Gist options
  • Save cange/509467 to your computer and use it in GitHub Desktop.
Save cange/509467 to your computer and use it in GitHub Desktop.
Find the largest, or smallest, number in an array. #learnjs
/**
* #learnjs
* Find the largest, or smallest, number in an array.
*/
var a = [-88, 4, 2, 0, 9, 1, 8];
Math.max.apply(Math, a); // 9
Math.min.apply(Math, a); // -88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment