Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
54
rated 0 times [  59] [ 5]  / answers: 1 / hits: 36424  / 11 Years ago, mon, april 22, 2013, 12:00:00

i've this simple function:



Chrome, Firefox, IE:



Number(1000000).toLocaleString()
1 000 000 // in french system, the space is the separator instead of the comma


Opera, Maxthon:



Number(1000000).toLocaleString()
1000000


why Opera and Maxthon cant format it? they support this method but dont execute it in the right way?



is there any toLocaleString() replacement?


More From » formatting

 Answers
9

The language spec leaves the definition very open-ended:




15.7.4.3 Number.prototype.toLocaleString()



Produces a String value that represents this Number value formatted according to the conventions of the host environment’s current locale. This function is implementation-dependent, and it is permissible, but not encouraged, for it to return the same thing as toString.




Different browsers are allowed to implement it differently, and can implement it differently based on the locale chosen by the user.


[#78705] Monday, April 22, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jackelyn

Total Points: 303
Total Questions: 103
Total Answers: 102

Location: Turks and Caicos Islands
Member since Sun, Mar 7, 2021
3 Years ago
jackelyn questions
Thu, Apr 8, 21, 00:00, 3 Years ago
Sun, Feb 28, 21, 00:00, 3 Years ago
Mon, May 25, 20, 00:00, 4 Years ago
Thu, Apr 30, 20, 00:00, 4 Years ago
;