_.clamp(number, [lower], upper)
Clamps number
within the inclusive lower
and upper
bounds.
Since
4.0.0
Arguments
-
number
(number): The number to clamp. -
[lower]
(number): The lower bound. -
upper
(number): The upper bound.
Returns
(number): Returns the clamped number.
Example
_.clamp(-10, -5, 5); // => -5 _.clamp(10, -5, 5); // => 5
Please login to continue.