diff options
author | Bierxiensi <40264423+Bierxiensi@users.noreply.github.com> | 2022-01-19 01:08:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-19 01:08:52 +0800 |
commit | 167bc67cbe3c274ba922780af240f59974c56aca (patch) | |
tree | 035dd1ecd2a39c2f9baf28c87142dbd099dc6e82 /files/zh-cn/web/javascript | |
parent | c5b916c1543ce2023e6df75afa5f9c9d1f483b72 (diff) | |
download | translated-content-167bc67cbe3c274ba922780af240f59974c56aca.tar.gz translated-content-167bc67cbe3c274ba922780af240f59974c56aca.tar.bz2 translated-content-167bc67cbe3c274ba922780af240f59974c56aca.zip |
zh-cn translate in sample code (#3681)
Diffstat (limited to 'files/zh-cn/web/javascript')
-rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/object/tostring/index.html | 2 |
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> |