formatNumber

Converts a Number into a string based on the specified format and locale.

For a runnable example, refer to the article on
date and number formatting and parsing.

Parameters

value number

The number that will be formatted.

format string | NumberFormatOptions

The format that will be applied.

locale? string

The locale id that defines the locale whose information should be used for the formatting.

Returns

string - The formatted number.