Created
March 5, 2014 22:52
-
-
Save lamchau/9378419 to your computer and use it in GitHub Desktop.
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
function min(array) { | |
if (Array.isArray(array)) { | |
return Math.min.apply(null, array.filter(isFinite)); | |
} | |
throw { | |
name: "Illegal argument", | |
message: "Argument must be an array" | |
} | |
} | |
function max(array) { | |
if (Array.isArray(array)) { | |
return Math.max.apply(null, array.filter(isFinite)); | |
} | |
throw { | |
name: "Illegal argument", | |
message: "Argument must be an array" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment