Created
August 4, 2016 10:29
-
-
Save edgarberm/0bb129bad9bdf72b38c983e66db8a8d1 to your computer and use it in GitHub Desktop.
Returns a number whose value is limited to the given range
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
clamp (n, min, max) { | |
return Math.max(Math.min(n, max), min) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment