Update clampNumber.md
This commit is contained in:
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
Clamps `num` within the inclusive `lower` and `upper` bounds.
|
Clamps `num` within the inclusive `lower` and `upper` bounds.
|
||||||
|
|
||||||
If `lower` is greater than `upper`, swap them. If `num` falls within the range, return `num`. Otherwise return the nearest number in the range.
|
If `lower` is greater than `upper`, swap them.
|
||||||
|
If `num` falls within the range, return `num`.
|
||||||
|
Otherwise return the nearest number in the range.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const clampNumber = (num, lower, upper) => {
|
const clampNumber = (num, lower, upper) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user