clamp()

Confine a given number to a specific range.

This function is valid in v2.0.0 to v2.13.3. This function has been downloaded 41 times.

Parameters

{number} x
The number to be confined to the specified range.
{number} min
The minimum number that can be returned.
{number} max
The maximum number that can be returned.

Returns

{number}
The closest number to x that is greater than or equal to min and less than or equal to max.