Clamps a value to the inclusive range [min, max].
[min, max]
The value to clamp.
Lower bound (inclusive).
Upper bound (inclusive).
The clamped value.
Requires min <= max; reversed bounds are not validated. For numbers, a NaN value is returned unchanged and comparisons against a NaN bound are false.
min <= max
NaN
clamp(15, 0, 10); // 10clamp(-2n, -1n, 5n); // -1n Copy
clamp(15, 0, 10); // 10clamp(-2n, -1n, 5n); // -1n
Clamps a value to the inclusive range
[min, max].