codetrix - v1.5.0
    Preparing search index...

    Function clamp

    • Clamps a number between a minimum and maximum value.

      Parameters

      • value: number

        The number to clamp.

      • min: number

        The lower boundary.

      • max: number

        The upper boundary.

      Returns number

      The clamped number.

      clamp(5, 1, 10); // 5
      clamp(-5, 0, 100); // 0