aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/global_objects/object/tolocalestring/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/object/tolocalestring/index.html')
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/object/tolocalestring/index.html80
1 files changed, 80 insertions, 0 deletions
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
+---
+<div>{{JSRef("Global_Objects", "Object")}}</div>
+
+<p><code><strong>toLocaleString()</strong></code> 方法返回一个该对象的字符串表示。此方法被用于派生对象为了特定语言环境的目的(locale-specific purposes)而重载使用。</p>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<pre class="syntaxbox"><code><var>obj</var>.toLocaleString();</code>
+</pre>
+
+<h3 id="返回值">返回值</h3>
+
+<p>表示对象的字符串。</p>
+
+<h2 id="Description" name="Description">描述</h2>
+
+<p>{{jsxref("Object")}} <code>toLocaleString</code> 返回调用 {{jsxref("Object.toString", "toString()")}} 的结果。</p>
+
+<p>该函数提供给对象一个通用的<code>toLocaleString</code> 方法,即使不是全部都可以使用它。 见下面的列表。</p>
+
+<h3 id="覆盖_toLocaleString_的对象">覆盖 <code>toLocaleString</code> 的对象</h3>
+
+<ul>
+ <li>{{jsxref("Array")}}:{{jsxref("Array.prototype.toLocaleString()")}}</li>
+ <li>{{jsxref("Number")}}:{{jsxref("Number.prototype.toLocaleString()")}}</li>
+ <li>{{jsxref("Date")}}:{{jsxref("Date.prototype.toLocaleString()")}}</li>
+</ul>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES3')}}</td>
+ <td>{{Spec2('ES3')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES5.1', '#sec-15.2.4.3', 'Object.prototype.toLocaleString')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-object.prototype.tolocalestring', 'Object.prototype.toLocaleString')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-object.prototype.tolocalestring', 'Object.prototype.toLocaleString')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<div class="hidden">The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</div>
+
+<p>{{Compat("javascript.builtins.Object.toLocaleString")}}</p>
+
+<h2 id="See_also" name="See_also">相关链接</h2>
+
+<ul>
+ <li>{{jsxref("Object.prototype.toString()")}}</li>
+</ul>