JavaScript & jQuery Tutorials

JS Home Right Arrow JS Reference Right Arrow Number Right Arrow toLocaleString()

toLocaleString()  Number  instance method

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



  

go to home page Homepage go to top of page Top