Function roundTo

  • Returns a number rounded to the number of decimal places provided.

    Parameters

    • n: number

      The number to round.

    • Optional digits: number

      The number of decimal places to round to.

    Returns number

    The rounded number.

    See

    Reference

    Example

    // 1.234
    roundTo(1.23456, 3)

    Example

    // 1
    roundTo(1.23456, 0)