JS toLocaleString()
Locale-aware formatting adapts separators and labels. Specify a locale and options for a predictable display policy.
Where to run this
This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.
A practical example
const amount = 1234.5;
console.log(amount.toLocaleString("en-GB", {minimumFractionDigits: 2}));
What happens
The number is displayed as 1,234.50 in this locale.