aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn')
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/object/tostring/index.html2
1 files changed, 1 insertions, 1 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/tostring/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/tostring/index.html
index af2c721813..7ff9cdb557 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/object/tostring/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/object/tostring/index.html
@@ -32,7 +32,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/toString
<p>每个对象都有一个 <code>toString()</code> 方法,当该对象被表示为一个文本值时,或者一个对象以预期的字符串方式引用时自动调用。默认情况下,<code>toString()</code> 方法被每个 <code>Object</code> 对象继承。如果此方法在自定义对象中未被覆盖,<code>toString()</code> 返回 "[object <em>type</em>]",其中 <code>type</code> 是对象的类型。以下代码说明了这一点:</p>
<pre class="brush: js">var o = new Object();
-o.toString(); // returns [object Object]
+o.toString(); // 返回 [object Object]
</pre>
<div class="note"><strong>注意:</strong>如 ECMAScript 5 和随后的 Errata 中所定义,从 JavaScript 1.8.5 开始,<code>toString()</code> 调用 {{jsxref("null")}} 返回<code>[object <em>Null</em>]</code>,{{jsxref("undefined")}} 返回 <code>[object Undefined]</code>。请参阅下面的{{anch("Using_toString()_to_detect_object_class", "使用 <code>toString()</code> 检测对象类型")}}。</div>