Created
June 5, 2023 07:37
-
-
Save jens1101/9890f8e5a9f49db198199c0ec28c215d to your computer and use it in GitHub Desktop.
How to clamp numbers in JS
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
const clamp = (num, min, max) => Math.min(Math.max(num, min), max); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment