A utility function that formats a number in specified locale

formatNumber(123456.789, 'de-DE') // 123.456,789
formatNumber(123456.789, 'en-US') // 123,456.789
  • Parameters

    • number: number

      The number to format

    • locale: LocalesArgument = 'en-US'

      The locale to use for formatting

    Returns string

    A string representation of the number in the specified locale