Number.prototype.clamp

Specification
Proposal repo

Modules

esnext.number.clamp

Built-ins signatures

class Number {
  clamp(min: number, max: number): number;
}

Entry points

core-js/proposals/math-clamp-v2
core-js(-pure)/full/number/clamp

Example

5.0.clamp(0, 10); // => 5
-5.0.clamp(0, 10); // => 0
15.0.clamp(0, 10); // => 10