Created
November 13, 2015 10:45
-
-
Save electerious/0410242d781e922a378d to your computer and use it in GitHub Desktop.
Limit a number between a min and max value
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 limit = (min, max, num) => 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
Example: