Created
September 16, 2019 08:02
-
-
Save TheDcoder/cb2f4c0c23791413caec68cd70086de6 to your computer and use it in GitHub Desktop.
Math.min in absolute terms
This file contains 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 absMin(...values) { | |
return values.find(value => { | |
value = Math.abs(value); | |
return values.every(x => Math.abs(x) >= value); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment