Function formatUnits

  • Divides a number by a given exponent of base 10 (10exponent), and formats it into a string representation of the number.

    This code snippet is taken from the Viem SDK.

    Parameters

    • value: bigint
    • decimals: number

    Returns string

    Example

    formatUnits(420000000000n, 9)
    // '420'