Created
December 7, 2023 16:17
-
-
Save dutchcelt/b3807dc41a17094ad56ff5a047da4e02 to your computer and use it in GitHub Desktop.
Clamp number
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
| /** | |
| * clamp | |
| * @param {number} num | |
| * @param {number} min | |
| * @param {number} max | |
| * @returns {number} | |
| */ | |
| 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