Created
July 10, 2023 07:43
-
-
Save MrKou47/cf405a7086b42d6ac41593996fd5bf04 to your computer and use it in GitHub Desktop.
Math.Clamp() in Javascript
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 clamp(value, min, max) { | |
return Math.min(Math.max(value, min), max); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment