JS Built-ins
NumbertoLocaleStringbeginner

toLocaleString() β€” returns a string

πŸ“– Usage Example
// Format number for the user's locale
const n = 1234567.89
n.toLocaleString()          // β†’ '1,234,567.89' (en-US)
n.toLocaleString('de-DE')   // β†’ '1.234.567,89'

Use toLocaleString() to format a number as a locale-appropriate string, such as adding thousands separators or currency symbols.

Number.prototype.toLocaleString()

num.toLocaleString(locale?, options?) returns a locale-aware string representation of the number.

πŸ’‘ Hints (1)
  • β€’ `toLocaleString()` formats numbers according to locale conventions.