Update clampNumber.md
This commit is contained in:
@ -7,7 +7,6 @@ Otherwise, return the nearest number in the range.
|
||||
|
||||
```js
|
||||
const clampNumber = (num, a, b) => Math.max(Math.min(num, Math.max(a,b)),Math.min(a,b));
|
||||
|
||||
// clampNumber(2, 3, 5) -> 3
|
||||
// clampNumber(1, -1, -5) -> -1
|
||||
// clampNumber(3, 2, 4) -> 3
|
||||
|
||||
Reference in New Issue
Block a user