From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../object/tolocalestring/index.html | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 files/zh-cn/web/javascript/reference/global_objects/object/tolocalestring/index.html (limited to 'files/zh-cn/web/javascript/reference/global_objects/object/tolocalestring') diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/tolocalestring/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/tolocalestring/index.html new file mode 100644 index 0000000000..611bfc560f --- /dev/null +++ b/files/zh-cn/web/javascript/reference/global_objects/object/tolocalestring/index.html @@ -0,0 +1,80 @@ +--- +title: Object.prototype.toLocaleString() +slug: Web/JavaScript/Reference/Global_Objects/Object/toLocaleString +tags: + - JavaScript + - Method + - Object + - Prototype +translation_of: Web/JavaScript/Reference/Global_Objects/Object/toLocaleString +--- +
{{JSRef("Global_Objects", "Object")}}
+ +

toLocaleString() 方法返回一个该对象的字符串表示。此方法被用于派生对象为了特定语言环境的目的(locale-specific purposes)而重载使用。

+ +

语法

+ +
obj.toLocaleString();
+
+ +

返回值

+ +

表示对象的字符串。

+ +

描述

+ +

{{jsxref("Object")}} toLocaleString 返回调用 {{jsxref("Object.toString", "toString()")}} 的结果。

+ +

该函数提供给对象一个通用的toLocaleString 方法,即使不是全部都可以使用它。 见下面的列表。

+ +

覆盖 toLocaleString 的对象

+ + + +

规范

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('ES3')}}{{Spec2('ES3')}}Initial definition.
{{SpecName('ES5.1', '#sec-15.2.4.3', 'Object.prototype.toLocaleString')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-object.prototype.tolocalestring', 'Object.prototype.toLocaleString')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-object.prototype.tolocalestring', 'Object.prototype.toLocaleString')}}{{Spec2('ESDraft')}} 
+ +

浏览器兼容性

+ + + +

{{Compat("javascript.builtins.Object.toLocaleString")}}

+ +

相关链接

+ + -- cgit v1.2.3-54-g00ecf