toLocaleString()  Number  instance method JS Home  <<  JS Reference  <<  Number  <<  toLocaleString()

Description

Returns a string representation of the number using locale specific notation.

This method overrides the toLocaleString() method of Object.

Syntax

Signature Description
aNumber.toLocaleString()Returns a string representation of the number using locale specific notation.

Parameters

None.

Examples

The code below displays some numerical values in default locale.


// Locale strings.
var aNumber = 1612345;
var bNumber = 1612345.234567;

alert(aNumber.toLocaleString());
alert(bNumber.toLocaleString());

Press the button below to action the above code:

Related Tutorials

JavaScript Advanced Tutorials - Lesson 3 - Number