diff options
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/object/tosource/index.html')
-rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/object/tosource/index.html | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/tosource/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/tosource/index.html index e609077520..5713289596 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/tosource/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/tosource/index.html @@ -14,15 +14,15 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/toSource <p><strong><code>toSource()</code></strong>方法返回一个表示对象源代码的字符串。</p> -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre class="syntaxbox"><code><em>Object.toSource(); obj</em>.toSource()</code></pre> -<h3 id="Parameters" name="Parameters">返回值</h3> +<h3 id="Parameters">返回值</h3> <p>一个表示对象的源代码的字符串。</p> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p><code>toSource()</code>方法返回以下值:</p> @@ -54,7 +54,7 @@ Person.prototype.toSource = function Person_toSource() { alert(new Person("Joe").toSource()); // ---> new Person("Joe")</pre> -<h3 id="Built-in_toString_methods" name="Built-in_toString_methods">内置<code>的toSource方法</code></h3> +<h3 id="Built-in_toString_methods">内置<code>的toSource方法</code></h3> <p>每个JavaScript核心类型都有它自己的<code>toSource()</code>方法.这些对象是:</p> @@ -89,9 +89,9 @@ console.log('Cyclical: ' + (obj1.b.a == obj1));</pre> <p>如果使用循环结构, 并且需要 <code>toSource()</code>, 则对象必须提供对 <code>toSource()</code> 的重写, 无论是对构造函数的引用还是提供匿名函数。</p> -<h2 id="Examples" name="Examples">示例</h2> +<h2 id="Examples">示例</h2> -<h3 id="Example:_Using_toSource" name="Example:_Using_toSource">使用<code>toSource()</code></h3> +<h3 id="Example:_Using_toSource">使用<code>toSource()</code></h3> <p>下面的代码定义了一个<code>Dog</code>对象类型还创建了一个<code>Dog</code>类型的对象实例<code>theDog</code>:</p> @@ -117,7 +117,7 @@ theDog = new Dog("Gabby", "Lab", "chocolate", "girl");</pre> <p>{{Compat("javascript.builtins.Object.toSource")}}</p> -<h2 id="See_Also" name="See_Also">相关链接</h2> +<h2 id="See_Also">相关链接</h2> <ul> <li>{{jsxref("Object.prototype.toString()")}}</li> |