• Clamps specified value within the inclusive lower and upper bounds.

    Parameters

    • value: number

      Value being clamped.

    • lower: number

      Lower bounds for the value.

    • upper: number

      Upper bounds for the value.

    Returns number

    The clamped value within the specified bounds.

    clamp(-10, -5, 5);
    // -5

    clamp(10, -5, 5)
    // 5