Created
August 5, 2010 09:15
-
-
Save cange/509467 to your computer and use it in GitHub Desktop.
Find the largest, or smallest, number in an array. #learnjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* #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