A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/javascript-number-tolocalestring-method/ below:

JavaScript Number toLocaleString() Method - GeeksforGeeks

JavaScript Number toLocaleString() Method

Last Updated : 23 Jul, 2025

The toLocaleString() method converts a number into a string, using a local language format. The language depends on the locale setup on your computer.

Syntax:

number.toLocaleString(locales, options)

Parameters: This method accepts two parameters locales and options.

Note: There are other options as parameters such as minimumFractionDigits, minimumSignificantDigits, currency, and many more. The developer can use them as per the requirement of the application.

Return value: The return value can be a string that represents a number.

Example: The following code demonstrates all the conversions.

JavaScript
// Declaring an variable a
let n = new Number(705870689);
console.log("ar-SA: " 
            + n.toLocaleString("ar-SA"));
console.log("bn-BD: " 
            + n.toLocaleString("bn-BD"));
console.log("bn-IN: " 
            + n.toLocaleString("bn-IN"));
console.log("cs-CZ: " 
            + n.toLocaleString("cs-CZ"));

Output:

ar-SA: ٧٠٥٬٨٧٠٬٦٨٩
bn-BD: ৭০,৫৮,৭০,৬৮৯
bn-IN: ৭০,৫৮,৭০,৬৮৯
cs-CZ: 705 870 689

Example 2: The following example demonstrates the style and currency attributes.

JavaScript
// Declaring an variable a
let a = new Number(159900);

// Creating an dictionary like object and
// include currency and style
let myObj = {
    style: "currency",
    currency: "EUR"
}

console.log(a.toLocaleString("en-GB", myObj));

Output:

€159,900.00

Supported Browsers:

We have a complete list of JavaScript Number constructor, properties, and methods list, to know more about the numbers please go through that article.



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4