views:

52

answers:

2

Do you know if toFixed is a localized function?

I mean will this:

var n = 100.67287;
alert(n.toFixed(2));

show "100.67" on english US OS/browsers and "100,67" (with comma) on Italian OS/browsers (Italian or any other local system that uses comma as decimal separator).

Thanks!

A: 

No, this will always return a point. The ECMA 262-spec [15.7.4.5] states it should be a point.

Robert Massa
A: 

Take a look at Number.toLocaleString().

Alex K.