Reference constrain()

constrain()

Constrains a number between a minimum and maximum value.

Examples

Syntax

constrain(n, low, high)

Parameters

n
Number:

number to constrain.

low
Number:

minimum limit.

high
Number:

maximum limit.

Returns

Number: constrained number.
Notice any errors or typos? Please let us know. Please feel free to edit src/math/calculation.js and open a pull request!

Related References