JS Built-ins
NumbertoLocaleStringintermediate

toLocaleString() β€” en-US locale includes 1 for 1000

πŸ“– 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.

toLocaleString() β€” Locale en-US

With the 'en-US' locale, (1000).toLocaleString('en-US') returns a string that includes '1'.

πŸ’‘ Hints (1)
  • β€’ `'en-US'` typically formats thousands with commas: `'1,000'`.