[size=medium]In ECMAScript v3 and JavaScript 1.5, the Object class defines a toLocaleString() method in addition to
its toString() method. The purpose of this method is to return a localized string representation of the
object. The default toLocaleString() method defined by Object doesn't do any localization itself; it always
returns exactly the same thing as toString() . Subclasses, however, may define their own versions of
toLocaleString() . In ECMAScript v3, the Array, Date, and Number classes do define toLocaleString()
methods that return localized values.
[/size]
its toString() method. The purpose of this method is to return a localized string representation of the
object. The default toLocaleString() method defined by Object doesn't do any localization itself; it always
returns exactly the same thing as toString() . Subclasses, however, may define their own versions of
toLocaleString() . In ECMAScript v3, the Array, Date, and Number classes do define toLocaleString()
methods that return localized values.
[/size]
本文介绍了ECMAScript v3及JavaScript 1.5中新增的toLocalString()方法,该方法用于返回对象的本地化字符串表示形式。默认情况下,此方法与toString()返回相同结果,但子类如Array、Date和Number提供了实现本地化的版本。
1271

被折叠的 条评论
为什么被折叠?



