Summary
This method available to numbers will convert the number into a string which is suitable for presentation in the given locale.
Method of Number |
|
|---|---|
| Implemented in | JavaScript 1.5 |
| ECMAScript Edition | ECMAScript 3rd Edition |
Syntax
number.toLocaleString()
Examples
var number = 3500; console.log(number.toLocaleString()); /* Displays "3,500" in English locale */
Mozilla Developer Network