Hex Core JS
    Preparing search index...

    Function abbreviateNumber

    • Returns an abbreviated form of the given number containing as few decimal values as possible and, if necessary, an alphabetical suffix.

      Parameters

      • value: number | null | undefined

        The number to return the abbreviation for.

      • __namedParameters: AbbreviateNumberOptions = {}

      Returns string

      Should only be used for special cases. In most cases Intl.NumberFormat with notation: "compact" will work better.

      abbreviateNumber(1234);
      // => "1.23K"

      abbreviateNumber(12345678);
      // => "12.3M"

      abbreviateNumber(123456789101);
      // => "123B"

      abbreviateNumber(12345678910111);
      // => "12.3T"