JavaScript Number toLocaleString()
JavaScript Number toLocaleString()
The toLocaleString() method is used to return a number as a string by using the local language format. It all depends upon the locale set up on the computer.
Syntax:-
Its syntax is:- number.toLocaleString(locales, options)
Return:-
Its return is:- string representing the number to the local format
Further Explanation:-
Parameter | Description |
locales | Optional.The language-specific format to use like en-CA, en-GB, en-US, en-AU, etc. |
options | Optional. An object with formatting options like currency, currencyDisplay, style, useGrouping, etc. |