diff options
author | t7yang <t7yang@gmail.com> | 2022-01-10 08:38:07 +0800 |
---|---|---|
committer | Irvin <irvinfly@gmail.com> | 2022-02-16 02:35:54 +0800 |
commit | c40612041809fe289aba58aefa170bbe784aba1f (patch) | |
tree | 8ca89b071d04afcf7abd6d9a04d0765a041d9c8a /files/zh-cn/web/javascript/reference/global_objects/object | |
parent | 12a899ab8540bc84f56a0dc6491be80a48499d49 (diff) | |
download | translated-content-c40612041809fe289aba58aefa170bbe784aba1f.tar.gz translated-content-c40612041809fe289aba58aefa170bbe784aba1f.tar.bz2 translated-content-c40612041809fe289aba58aefa170bbe784aba1f.zip |
remove name attribute for zh-CN
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/object')
23 files changed, 117 insertions, 117 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/__definegetter__/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/__definegetter__/index.html index 209a7897e3..b0229c493e 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/__definegetter__/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/__definegetter__/index.html @@ -5,11 +5,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__ --- <div> {{JSRef("Global_Objects", "Object")}} {{non-standard_header}} {{deprecated_header}}</div> -<h2 id="Summary" name="Summary">概述</h2> +<h2 id="Summary">概述</h2> <p><code><strong>__defineGetter__</strong></code> 方法可以将一个函数绑定在当前对象的指定属性上,当那个属性的值被读取时,你所绑定的函数就会被调用。</p> -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre class="syntaxbox"><code><var>obj</var>.__defineGetter__(<var>prop</var>, <var>func</var>)</code></pre> -<h3 id="Parameters" name="Parameters">参数</h3> +<h3 id="Parameters">参数</h3> <dl> <dt> <code>prop</code></dt> @@ -20,9 +20,9 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__ <dd> 一个函数,当 <code>prop</code> 属性的值被读取时自动被调用。</dd> </dl> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p><code>__defineGetter__ 方法可以为一个已经存在的对象设置(新建或修改)访问器属性,</code>而 {{jsxref("Operators/get", "对象字面量中的 get 语法", "", 1)}} 只能在新建一个对象时使用。</p> -<h2 id="Examples" name="Examples">示例</h2> +<h2 id="Examples">示例</h2> <pre class="brush: js">// 请注意,该方法是非标准的: var o = {}; @@ -45,9 +45,9 @@ Object.defineProperty(o, 'gimmeFive', { }); console.log(o.gimmeFive); // 5 </pre> -<h2 id="Specifications" name="Specifications">规范</h2> +<h2 id="Specifications">规范</h2> <p>不属于任何规范。</p> -<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2> +<h2 id="Browser_compatibility">浏览器兼容性</h2> <div> {{CompatibilityTable}}</div> <div> @@ -96,7 +96,7 @@ console.log(o.gimmeFive); // 5 </tbody> </table> </div> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li>{{jsxref("Object.prototype.__defineSetter__()")}}</li> <li>{{jsxref("Operators/get", "get")}} operator</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/__definesetter__/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/__definesetter__/index.html index 2aaac6314d..b854a96ea0 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/__definesetter__/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/__definesetter__/index.html @@ -5,11 +5,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/__defineSetter__ --- <div> {{JSRef("Global_Objects", "Object")}} {{non-standard_header}} {{deprecated_header}}</div> -<h2 id="Summary" name="Summary">概述</h2> +<h2 id="Summary">概述</h2> <p><code><strong>__defineSetter__ </strong>方法可以将一个函数绑定在当前对象的指定属性</code>上,当那个属性被赋值时,你所绑定的函数就会被调用。</p> -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre class="syntaxbox"><code><var>obj</var>.__defineSetter__(<var>prop</var>, <var>fun</var>)</code></pre> -<h3 id="Parameters" name="Parameters">参数</h3> +<h3 id="Parameters">参数</h3> <dl> <dt> <code>prop</code></dt> @@ -28,11 +28,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/__defineSetter__ </dl> </dd> </dl> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p><code>__defineSetter__</code> 方法可以为一个已经存在的对象设置(新建或修改)访问器属性,而 {{jsxref("Operators/set", "对象字面量中的 set 语法", "", 1)}} 只能在新建一个对象时使用。</p> -<h2 id="Specifications" name="Specifications">规范</h2> +<h2 id="Specifications">规范</h2> <p>不属于任何规范。</p> -<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2> +<h2 id="Browser_compatibility">浏览器兼容性</h2> <div> {{CompatibilityTable}}</div> <div> @@ -81,7 +81,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/__defineSetter__ </tbody> </table> </div> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li>{{jsxref("Object.prototype.__defineGetter__()")}}</li> <li>{{jsxref("Operators/set", "set")}} operator</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/__lookupgetter__/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/__lookupgetter__/index.html index c9200b5194..52fe502257 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/__lookupgetter__/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/__lookupgetter__/index.html @@ -5,22 +5,22 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/__lookupGetter__ --- <div>{{JSRef("Global_Objects", "Object")}} {{ Non-standard_header }} {{ Deprecated_header }}</div> -<h2 id="Summary" name="Summary">概述</h2> +<h2 id="Summary">概述</h2> <p><code><strong>__lookupGetter__</strong></code> 方法会返回当前对象上指定属性的<strong>属性读取访问器函数(getter)。</strong></p> -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre class="syntaxbox"><code><em>obj</em>.__lookupGetter__(<em>sprop</em>)</code></pre> -<h3 id="Parameters" name="Parameters">参数</h3> +<h3 id="Parameters">参数</h3> <dl> <dt><code>sprop</code></dt> <dd>属性名</dd> </dl> -<h2 id="Examples" name="Examples">示例</h2> +<h2 id="Examples">示例</h2> <pre class="brush: js">var obj = { get foo() { @@ -31,7 +31,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/__lookupGetter__ obj.__lookupGetter__("foo") // (function (){return Math.random() > 0.5 ? "foo" : "bar"}) </pre> -<h2 id="Description" name="Description">附注</h2> +<h2 id="Description">附注</h2> <p><code><strong>__lookupGetter__</strong></code> 方法是非标准的,我们应该使用标准中定义的方法来完成同样的事情,那就是 {{jsxref("Object.getOwnPropertyDescriptor()")}} 方法:</p> @@ -53,7 +53,7 @@ Object.getOwnPropertyDescriptor(prototype, "foo").get // function __proto__() {[native code]} </pre> -<h2 id="Specifications" name="Specifications">规范</h2> +<h2 id="Specifications">规范</h2> <p>不属于任何规范。</p> @@ -109,7 +109,7 @@ Object.getOwnPropertyDescriptor(prototype, "foo").get </table> </div> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li>{{jsxref("Object.__lookupSetter__", "Object.prototype.__lookupSetter__()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/assign/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/assign/index.html index 080c859773..c81cacda30 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/assign/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/assign/index.html @@ -18,11 +18,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/assign -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre class="syntaxbox"><code>Object.assign(<var>target</var>, ...<var>sources</var>)</code></pre> -<h3 id="Parameters" name="Parameters">参数</h3> +<h3 id="Parameters">参数</h3> <dl> <dt><code>target</code></dt> @@ -31,7 +31,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/assign <dd>源对象。</dd> </dl> -<h3 id="Return_value" name="Return_value">返回值</h3> +<h3 id="Return_value">返回值</h3> <p>目标对象。</p> @@ -83,16 +83,16 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/assign }); }</pre> -<h2 id="Examples" name="Examples">示例</h2> +<h2 id="Examples">示例</h2> -<h3 id="Example_Cloning_an_object" name="Example:_Cloning_an_object">复制一个对象</h3> +<h3 id="Example_Cloning_an_object">复制一个对象</h3> <pre class="brush: js">const obj = { a: 1 }; const copy = Object.assign({}, obj); console.log(copy); // { a: 1 } </pre> -<h3 id="Deep_Clone" name="Deep_Clone">深拷贝问题</h3> +<h3 id="Deep_Clone">深拷贝问题</h3> <p>针对深拷贝,需要使用其他办法,因为 <code>Object.assign()</code>拷贝的是(可枚举)属性值。</p> @@ -137,7 +137,7 @@ function test() { test(); </pre> -<h3 id="Example_Merging_objects" name="Example:_Merging_objects">合并对象</h3> +<h3 id="Example_Merging_objects">合并对象</h3> <pre class="brush: js">const o1 = { a: 1 }; const o2 = { b: 2 }; @@ -159,7 +159,7 @@ console.log(obj); // { a: 1, b: 2, c: 3 }</pre> <p>属性被后续参数中具有相同属性的其他对象覆盖。</p> -<h3 id="Example_Symbol_properties" name="Example:_Symbol_properties">拷贝 symbol 类型的属性</h3> +<h3 id="Example_Symbol_properties">拷贝 symbol 类型的属性</h3> <pre class="brush: js">const o1 = { a: 1 }; const o2 = { [Symbol('foo')]: 2 }; @@ -168,7 +168,7 @@ const obj = Object.assign({}, o1, o2); console.log(obj); // { a : 1, [Symbol("foo")]: 2 } (cf. bug 1207182 on Firefox) Object.getOwnPropertySymbols(obj); // [Symbol(foo)]</pre> -<h3 id="Example_Only_own_enumerable_properties" name="Example:_Only_own_enumerable_properties">继承属性和不可枚举属性是不能拷贝的</h3> +<h3 id="Example_Only_own_enumerable_properties">继承属性和不可枚举属性是不能拷贝的</h3> <pre class="brush: js">const obj = Object.create({foo: 1}, { // foo 是个继承属性。 bar: { @@ -184,7 +184,7 @@ const copy = Object.assign({}, obj); console.log(copy); // { baz: 3 } </pre> -<h3 id="Example_Primitives" name="Example:_Primitives">原始类型会被包装为对象</h3> +<h3 id="Example_Primitives">原始类型会被包装为对象</h3> <pre class="brush: js">const v1 = "abc"; const v2 = true; @@ -196,7 +196,7 @@ const obj = Object.assign({}, v1, null, v2, undefined, v3, v4); // 注意,只有字符串的包装对象才可能有自身可枚举属性。 console.log(obj); // { "0": "a", "1": "b", "2": "c" }</pre> -<h3 id="Example_Exceptions" name="Example:_Exceptions">异常会打断后续拷贝任务</h3> +<h3 id="Example_Exceptions">异常会打断后续拷贝任务</h3> <pre class="brush: js">const target = Object.defineProperty({}, "foo", { value: 1, @@ -214,7 +214,7 @@ console.log(target.foo3); // undefined,异常之后 assign 方法就退出了 console.log(target.baz); // undefined,第三个源对象更是不会被拷贝到的。 </pre> -<h3 id="Example_Copy_accessors" name="Example:_Copy_accessors">拷贝访问器</h3> +<h3 id="Example_Copy_accessors">拷贝访问器</h3> <pre class="brush: js">const obj = { foo: 1, @@ -251,7 +251,7 @@ console.log(copy); // { foo:1, get bar() { return 2 } } </pre> -<h2 id="Polyfill" name="Polyfill">Polyfill</h2> +<h2 id="Polyfill">Polyfill</h2> <p>此{{Glossary("Polyfill","polyfill")}}不支持 symbol 属性,因为ES5 中根本没有 symbol :</p> @@ -285,7 +285,7 @@ console.log(copy); }); }</pre> -<h2 id="Specifications" name="Specifications">规范</h2> +<h2 id="Specifications">规范</h2> <table class="standard-table"> <tbody> @@ -307,11 +307,11 @@ console.log(copy); </tbody> </table> -<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容</h2> +<h2 id="Browser_compatibility">浏览器兼容</h2> <p>{{Compat("javascript.builtins.Object.assign")}}</p> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li>{{jsxref("Object.defineProperties()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/constructor/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/constructor/index.html index ac1375763a..8a69de0bb1 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/constructor/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/constructor/index.html @@ -12,7 +12,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/constructor <p>返回创建实例对象的 {{jsxref("Object")}} 构造函数的引用。注意,此属性的值是对函数本身的引用,而不是一个包含函数名称的字符串。对原始类型来说,如<code>1</code>,<code>true</code>和<code>"test"</code>,该值只可读。</p> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p>所有对象都会从它的原型上继承一个 <code>constructor</code> 属性:</p> @@ -31,9 +31,9 @@ a.constructor === Array // true var n = new Number(3); n.constructor === Number; // true</pre> -<h2 id="Examples" name="Examples">示例</h2> +<h2 id="Examples">示例</h2> -<h3 id="Example_Displaying_the_constructor_of_an_object" name="Example:_Displaying_the_constructor_of_an_object">打印一个对象的构造函数</h3> +<h3 id="Example_Displaying_the_constructor_of_an_object">打印一个对象的构造函数</h3> <p>以下示例创建一个原型,<code>Tree</code>,以及该类型的对象,即<code>theTree</code>。 然后打印<code>theTree</code>对象的<code>constructor</code>属性。</p> @@ -50,7 +50,7 @@ console.log( "theTree.constructor is " + theTree.constructor );</pre> this.name = name; }</pre> -<h3 id="Example_Changing_the_constructor_of_an_object" name="Example:_Changing_the_constructor_of_an_object">改变对象的 constructor</h3> +<h3 id="Example_Changing_the_constructor_of_an_object">改变对象的 constructor</h3> <p>下面的例子展示了如何修改基本类型对象的 <code>constructor</code> 属性的值。只有 <code>true</code>, <code>1</code> 和 <code>"test"</code> 的不受影响,因为创建他们的是只读的原生构造函数(native constructors)。这个例子也说明了依赖一个对象的 <code>constructor</code> 属性并不安全。</p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/create/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/create/index.html index 9bd6e7589c..244698d026 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/create/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/create/index.html @@ -16,11 +16,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/create <div>{{EmbedInteractiveExample("pages/js/object-create.html", "taller")}}</div> -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre>Object.create(<var>proto,[</var><var>propertiesObject</var>])</pre> -<h3 id="Parameters" name="Parameters">参数</h3> +<h3 id="Parameters">参数</h3> <dl> <dt><code>proto</code></dt> @@ -29,15 +29,15 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/create <dd>可选。需要传入一个对象,该对象的属性类型参照{{jsxref("Object.defineProperties()")}}的第二个参数。如果该参数被指定且不为 {{jsxref("undefined")}},该传入对象的自有可枚举属性(即其自身定义的属性,而不是其原型链上的枚举属性)将为新创建的对象添加指定的属性值和对应的属性描述符。</dd> </dl> -<h3 id="Parameters" name="Parameters">返回值</h3> +<h3 id="Parameters">返回值</h3> <p>一个新对象,带着指定的原型对象和属性。</p> -<h3 id="Description" name="Description">例外</h3> +<h3 id="Description">例外</h3> <p>如果<code>proto</code>参数不是 {{jsxref("null")}} 或非原始包装对象,则抛出一个 {{jsxref("TypeError")}} 异常。</p> -<h2 id="Examples" name="Examples">例子</h2> +<h2 id="Examples">例子</h2> <h3 id="用_Object.create实现类式继承">用 <code>Object.create</code>实现类式继承</h3> @@ -213,7 +213,7 @@ o2 = Object.create({}, { <p>{{Compat("javascript.builtins.Object.create")}}</p> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li>{{jsxref("Object.defineProperty")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/defineproperties/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/defineproperties/index.html index 9758d0af9b..81b3e2fe8b 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/defineproperties/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/defineproperties/index.html @@ -12,11 +12,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/defineProperties <p><strong><code>Object.defineProperties()</code> </strong>方法直接在一个对象上定义新的属性或修改现有属性,并返回该对象。</p> -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre><code>Object.defineProperties(<var>obj</var>, <var>props</var>)</code></pre> -<h3 id="Parameters" name="Parameters">参数</h3> +<h3 id="Parameters">参数</h3> <dl> <dt><code>obj</code></dt> @@ -172,7 +172,7 @@ Object.defineProperties(obj, { <p>{{Compat("javascript.builtins.Object.defineProperties")}}</p> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li>{{jsxref("Object.defineProperty()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/freeze/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/freeze/index.html index bd48ad319b..6237badeea 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/freeze/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/freeze/index.html @@ -16,11 +16,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/freeze -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre class="syntaxbox"><code>Object.freeze(<em>obj</em>)</code></pre> -<h3 id="Parameters" name="Parameters">参数</h3> +<h3 id="Parameters">参数</h3> <dl> <dt><code>obj</code></dt> @@ -31,7 +31,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/freeze <p>被冻结的对象。</p> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p>被冻结对象自身的所有属性都不可能以任何方式被修改。任何修改尝试都会失败,无论是静默地还是通过抛出{{jsxref("TypeError")}}异常(最常见但不仅限于{{jsxref("Strict_mode", "strict mode", "", 1)}})。</p> @@ -39,7 +39,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/freeze <p>这个方法返回传递的对象,而不是创建一个被冻结的副本。</p> -<h2 id="Examples" name="Examples">例子</h2> +<h2 id="Examples">例子</h2> <h3 id="冻结对象">冻结对象</h3> @@ -193,7 +193,7 @@ TypeError: 1 is not an object // ES5 code <p>{{Compat("javascript.builtins.Object.freeze")}}</p> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li>{{jsxref("Object.isFrozen")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertydescriptor/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertydescriptor/index.html index b8432c64bd..c9854cdd57 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertydescriptor/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertydescriptor/index.html @@ -14,11 +14,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDes <p>{{EmbedInteractiveExample("pages/js/object-getownpropertydescriptor.html")}}</p> -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre class="syntaxbox">Object.getOwnPropertyDescriptor(<em>obj</em>, <em>prop</em>)</pre> -<h3 id="Parameters" name="Parameters">参数</h3> +<h3 id="Parameters">参数</h3> <dl> <dt><code>obj</code></dt> @@ -31,7 +31,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDes <p>如果指定的属性存在于对象上,则返回其属性描述符对象(property descriptor),否则返回 {{jsxref("undefined")}}。</p> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p>该方法允许对一个属性的描述进行检索。在 Javascript 中, <dfn>属性</dfn> 由一个字符串类型的“名字”(name)和一个“属性描述符”(property descriptor)对象构成。更多关于属性描述符类型以及他们属性的信息可以查看:{{jsxref("Object.defineProperty")}}.</p> @@ -52,7 +52,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDes <dd>当且仅当指定对象的属性可以被枚举出时,为 <code>true</code>。</dd> </dl> -<h2 id="Examples" name="Examples">示例</h2> +<h2 id="Examples">示例</h2> <pre class="brush: js">var o, d; diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertynames/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertynames/index.html index 3f86e43049..283fb1e9bd 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertynames/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertynames/index.html @@ -14,7 +14,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNam <p><strong><code>Object.getOwnPropertyNames()</code></strong>方法返回一个由指定对象的所有自身属性的属性名(包括不可枚举属性但不包括Symbol值作为名称的属性)组成的数组。</p> -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre class="syntaxbox">Object.getOwnPropertyNames(<em>obj</em>)</pre> @@ -29,7 +29,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNam <p>在给定对象上找到的自身属性对应的字符串数组。</p> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p><code>Object.getOwnPropertyNames()</code> 返回一个数组,该数组对元素是 <code>obj</code>自身拥有的枚举或不可枚举属性名称字符串。 数组中枚举属性的顺序与通过 {{jsxref("Statements/for...in", "for...in")}} 循环(或 {{jsxref("Object.keys")}})迭代该对象属性时一致。数组中不可枚举属性的顺序未定义。</p> @@ -109,7 +109,7 @@ console.log(nonenum_only);</pre> <pre>注:<a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/filter">Array.filter(filt_func)方法</a>创建一个新数组, 其包含通过所提供函数实现的测试的所有元素。</pre> -<h2 id="Notes" name="Notes">提示</h2> +<h2 id="Notes">提示</h2> <p>在 ES5 中,如果参数不是一个原始对象类型,将抛出一个 {{jsxref("TypeError")}} 异常。在 ES2015 中,非对象参数被强制转换为对象 <strong>。</strong></p> @@ -155,7 +155,7 @@ Object.getOwnPropertyNames('foo'); <p>Firefox 28 {{geckoRelease("28")}}之前,<code>Object.getOwnPropertyNames</code> 不会获取到 {{jsxref("Error")}} 对象的属性。该 bug 在后面的版本修复了 ({{bug("724768")}})。</p> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li><a href="https://developer.mozilla.org/en-US/docs/Enumerability_and_ownership_of_properties" title="Enumerability_and_ownership_of_properties">Enumerability and ownership of properties</a></li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertysymbols/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertysymbols/index.html index 228674372c..f763ec6856 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertysymbols/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/getownpropertysymbols/index.html @@ -12,11 +12,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySym <p><code><strong>Object.getOwnPropertySymbols()</strong></code> 方法返回一个给定对象自身的所有 Symbol 属性的数组。</p> -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre class="syntaxbox"><code>Object.getOwnPropertySymbols(<em>obj</em>)</code></pre> -<h3 id="Parameters" name="Parameters">参数</h3> +<h3 id="Parameters">参数</h3> <dl> <dt><code>obj</code></dt> @@ -27,7 +27,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySym <dd>在给定对象自身上找到的所有 Symbol 属性的数组。</dd> </dl> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p>与{{jsxref("Object.getOwnPropertyNames()")}}类似,您可以将给定对象的所有符号属性作为 Symbol 数组获取。 请注意,{{jsxref("Object.getOwnPropertyNames()")}}本身不包含对象的 Symbol 属性,只包含字符串属性。</p> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/getprototypeof/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/getprototypeof/index.html index 2d8e4928f8..d644eb2f6c 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/getprototypeof/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/getprototypeof/index.html @@ -31,7 +31,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf <p>{{EmbedInteractiveExample("pages/js/object-getprototypeof.html")}}</p> -<h2 id="Examples" name="Examples">示例</h2> +<h2 id="Examples">示例</h2> <pre class="brush: js">var proto = {}; var obj = Object.create(proto); @@ -65,7 +65,7 @@ Object.prototype === Object.getPrototypeOf( obj ); // true Object.prototype === Object.getPrototypeOf( {} ); // true</pre> -<h2 id="Notes" name="Notes">Notes</h2> +<h2 id="Notes">Notes</h2> <p>在 ES5 中,如果参数不是一个对象类型,将抛出一个{{jsxref("TypeError")}}异常。在 ES2015 中,参数会被强制转换为一个 {{jsxref("Object")}}<strong>。</strong></p> @@ -109,7 +109,7 @@ Object.getPrototypeOf('foo'); <p>即使旧版本Opera不支持<code>Object.getPrototypeOf()</code>,Opera 10.50之后还支持非标准的 {{jsxref("Object.proto", "__proto__")}}属性。</p> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li>{{jsxref("Object.prototype.isPrototypeOf")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/index.html index e143a7d49d..69831fc8a8 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/index.html @@ -133,9 +133,9 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object -<h2 id="Examples" name="Examples">示例</h2> +<h2 id="Examples">示例</h2> -<h3 id="Example.3A_Using_Object_given_undefined_and_null_types" name="Example.3A_Using_Object_given_undefined_and_null_types">给定 <code>undefined</code> 和 <code>null</code> 类型使用 <code>Object</code></h3> +<h3 id="Example.3A_Using_Object_given_undefined_and_null_types">给定 <code>undefined</code> 和 <code>null</code> 类型使用 <code>Object</code></h3> <p>下面的例子将一个空的 <code>Object</code> 对象存到 <code>o</code> 中:</p> @@ -301,7 +301,7 @@ Object.prototype.valueOf = function() { <p>{{Compat("javascript.builtins.Object")}}</p> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li><a href="/zh-CN/docs/Web/JavaScript/Reference/Operators/Object_initializer">初始化对象</a></li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/isextensible/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/isextensible/index.html index 817dd1296a..1a515b96ff 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/isextensible/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/isextensible/index.html @@ -5,15 +5,15 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/isExtensible --- <div>{{JSRef("Global_Objects", "Object")}}</div> -<h2 id="Summary" name="Summary">概述</h2> +<h2 id="Summary">概述</h2> <p><code><strong>Object.isExtensible()</strong></code> 方法判断一个对象是否是可扩展的(是否可以在它上面添加新的属性)。</p> -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre class="syntaxbox"><code>Object.isExtensible(<em>obj</em>)</code></pre> -<h3 id="Parameters" name="Parameters">参数</h3> +<h3 id="Parameters">参数</h3> <dl> <dt>obj</dt> @@ -24,11 +24,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/isExtensible <p> 表示给定对象是否可扩展的一个<a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Boolean" title="此页面仍未被本地化, 期待您的翻译!"><code>Boolean</code></a> 。</p> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p>默认情况下,对象是可扩展的:即可以为他们添加新的属性。以及它们的 {{jsxref("Object.proto", "__proto__")}}{{deprecated_inline}} 属性可以被更改。{{jsxref("Object.preventExtensions")}},{{jsxref("Object.seal")}} 或 {{jsxref("Object.freeze")}} 方法都可以标记一个对象为不可扩展(non-extensible)。</p> -<h2 id="Examples" name="Examples">例子</h2> +<h2 id="Examples">例子</h2> <pre class="brush: js">// 新对象默认是可扩展的. var empty = {}; @@ -133,7 +133,7 @@ Object.isExtensible(1); </table> </div> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li><strong>{{jsxref("Object.preventExtensions")}}</strong></li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/isfrozen/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/isfrozen/index.html index 9a730a6d2c..cc428900b0 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/isfrozen/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/isfrozen/index.html @@ -13,11 +13,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/isFrozen <p><code><strong>Object.isFrozen()</strong></code>方法判断一个对象是否被{{jsxref("Object.freeze()", "冻结", "", 1)}}。</p> -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre class="syntaxbox"><code>Object.isFrozen(<var>obj</var>)</code></pre> -<h3 id="Parameters" name="Parameters">参数</h3> +<h3 id="Parameters">参数</h3> <dl> <dt><code>obj</code></dt> @@ -28,11 +28,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/isFrozen <dd>表示给定对象是否被冻结的{{jsxref("Boolean")}}。</dd> </dl> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p>一个对象是冻结的是指它不可{{jsxref("Object.isExtensible", "扩展")}},所有属性都是不可配置的,且所有数据属性(即没有getter或setter组件的访问器的属性)都是不可写的。</p> -<h2 id="Examples" name="Examples">例子</h2> +<h2 id="Examples">例子</h2> <pre class="brush: js">// 一个对象默认是可扩展的,所以它也是非冻结的. Object.isFrozen({}); // === false @@ -140,7 +140,7 @@ Object.isFrozen(1); <p>{{Compat("javascript.builtins.Object.isFrozen")}}</p> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li>{{jsxref("Object.freeze()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/issealed/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/issealed/index.html index 2a70e41e8e..1bb6ae71d7 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/issealed/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/issealed/index.html @@ -31,7 +31,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/isSealed <p>如果这个对象是密封的,则返回 <code>true</code>,否则返回 <code>false</code>。密封对象是指那些不可 {{jsxref("Object.isExtensible", "扩展")}} 的,且所有自身属性都不可配置且因此不可删除(但不一定是不可写)的对象。</p> -<h2 id="Examples" name="Examples">例子</h2> +<h2 id="Examples">例子</h2> <pre class="brush: js">// 新建的对象默认不是密封的. var empty = {}; diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/keys/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/keys/index.html index 3a778356b0..9509e7e18c 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/keys/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/keys/index.html @@ -13,11 +13,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/keys <p><code><strong>Object.keys()</strong></code> 方法会返回一个由一个给定对象的自身可枚举属性组成的数组,数组中属性名的排列顺序和正常循环遍历该对象时返回的顺序一致 。</p> -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre class="syntaxbox"><code>Object.keys(<var>obj</var>)</code></pre> -<h3 id="Parameters" name="Parameters">参数</h3> +<h3 id="Parameters">参数</h3> <dl> <dt>obj</dt> @@ -28,7 +28,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/keys <p>一个表示给定对象的所有可枚举属性的字符串数组。</p> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p><code>Object.keys</code> 返回一个所有元素为字符串的数组,其元素来自于从给定的<code>object</code>上面可直接枚举的属性。这些属性的顺序与手动遍历该对象属性时的一致。</p> @@ -146,7 +146,7 @@ Object.keys("foo"); <p>{{Compat("javascript.builtins.Object.keys")}}</p> </div> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li><a href="https://developer.mozilla.org/en-US/docs/Enumerability_and_ownership_of_properties">Enumerability and ownership of properties</a></li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/preventextensions/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/preventextensions/index.html index f412762462..09c0ff1c1a 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/preventextensions/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/preventextensions/index.html @@ -14,11 +14,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/preventExtensions <p>{{EmbedInteractiveExample("pages/js/object-preventextensions.html")}}</p> -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre class="syntaxbox"><code>Object.preventExtensions(<em>obj</em>)</code></pre> -<h3 id="Parameters" name="Parameters">参数</h3> +<h3 id="Parameters">参数</h3> <dl> <dt><code>obj</code></dt> @@ -29,7 +29,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/preventExtensions <dd>已经不可扩展的对象。</dd> </dl> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p>如果一个对象可以添加新的属性,则这个对象是可扩展的。<code>Object.preventExtensions()</code>将对象标记为不再可扩展,这样它将永远不会具有它被标记为不可扩展时持有的属性之外的属性。注意,一般来说,不可扩展对象的属性可能仍然可被<em>删除</em>。尝试将新属性添加到不可扩展对象将静默失败或抛出{{jsxref("TypeError")}}(最常见的情况是{{jsxref("Functions_and_function_scope/Strict_mode", "strict mode", "", 1)}}中,但不排除其他情况)。</p> @@ -39,7 +39,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/preventExtensions <p>一旦将对象变为不可扩展的对象,就再也不能使其可扩展。</p> -<h2 id="Examples" name="Examples">例子</h2> +<h2 id="Examples">例子</h2> <pre class="brush: js">// Object.preventExtensions将原对象变的不可扩展,并且返回原对象. var obj = {}; @@ -117,7 +117,7 @@ Object.preventExtensions(1); <p>{{Compat("javascript.builtins.Object.preventExtensions")}}</p> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li>{{jsxref("Object.isExtensible()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/seal/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/seal/index.html index 69d14321ee..ad57d66c17 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/seal/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/seal/index.html @@ -18,11 +18,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/seal -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre class="syntaxbox"><code>Object.seal(<em>obj</em>)</code></pre> -<h3 id="Parameters" name="Parameters">参数</h3> +<h3 id="Parameters">参数</h3> <dl> <dt><code>obj</code></dt> @@ -33,7 +33,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/seal <p>被密封的对象。</p> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p>通常,一个对象是{{jsxref("Object.isExtensible()", "可扩展的", "", 1)}}(可以添加新的属性)。密封一个对象会让这个对象变的不能添加新属性,且所有已有属性会变的不可配置。属性不可配置的效果就是属性变的不可删除,以及一个数据属性不能被重新定义成为访问器属性,或者反之。但属性的值仍然可以修改。尝试删除一个密封对象的属性或者将某个密封对象的属性从数据属性转换成访问器属性,结果会静默失败或抛出{{jsxref("TypeError")}}(在{{jsxref("Strict_mode", "严格模式", "", 1)}} 中最常见的,但不唯一)。</p> @@ -41,7 +41,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/seal <p>返回被密封对象的引用。</p> -<h2 id="Examples" name="Examples">例子</h2> +<h2 id="Examples">例子</h2> <pre class="brush: js">var obj = { prop: function() {}, @@ -132,7 +132,7 @@ Object.seal(1); </tbody> </table> -<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容</h2> +<h2 id="Browser_compatibility">浏览器兼容</h2> <div> @@ -140,7 +140,7 @@ Object.seal(1); <p>{{Compat("javascript.builtins.Object.seal")}}</p> </div> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li>{{jsxref("Object.isSealed()")}}</li> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/setprototypeof/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/setprototypeof/index.html index cf2df7e50d..06de1bcc7c 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/setprototypeof/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/setprototypeof/index.html @@ -24,11 +24,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf <p><strong>警告:</strong> 由于现代 JavaScript 引擎优化属性访问所带来的特性的关系,更改对象的 <code>[[Prototype]]</code>在<em><strong>各个</strong></em>浏览器和 JavaScript 引擎上都是一个很慢的操作。其在更改继承的性能上的影响是微妙而又广泛的,这不仅仅限于 <code>obj.__proto__ = ...</code> 语句上的时间花费,而且可能会延伸到<em><strong>任何</strong></em>代码,那些可以访问<em><strong>任何</strong></em><code>[[Prototype]]</code>已被更改的对象的代码。如果你关心性能,你应该避免设置一个对象的 <code>[[Prototype]]</code>。相反,你应该使用 {{jsxref("Object.create()")}}来创建带有你想要的<code>[[Prototype]]</code>的新对象。</p> </div> -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre class="syntaxbox"><code>Object.setPrototypeOf(<em>obj, prototype</em>)</code></pre> -<h3 id="Parameters" name="Parameters">参数</h3> +<h3 id="Parameters">参数</h3> <dl> <dt>obj</dt> @@ -37,7 +37,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf <dd>该对象的新原型(一个对象 或 {{jsxref("null")}}).</dd> </dl> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p>如果对象的[[Prototype]]被修改成不可扩展(通过 {{jsxref("Object.isExtensible()")}}查看),就会抛出 {{jsxref("TypeError")}}异常。如果<code>prototype</code>参数不是一个对象或者{{jsxref("null")}}(例如,数字,字符串,boolean,或者 {{jsxref("undefined")}}),则什么都不做。否则,该方法将<code>obj</code>的<code>[[Prototype]]</code>修改为新的值。</p> @@ -47,7 +47,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf <pre><code>var dict = Object.setPrototypeOf({}, null);</code></pre> -<h2 id="Notes" name="Notes">Polyfill</h2> +<h2 id="Notes">Polyfill</h2> <p>我们必须借助非标准的 </p> @@ -219,7 +219,7 @@ george(); // 'Hello guys!!'</pre> <div></div> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li>{{jsxref("Reflect.setPrototypeOf()")}}</li> 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 index 8d5a9d6538..bb3ec0e756 100644 --- 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 @@ -12,7 +12,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/toLocaleString <p><code><strong>toLocaleString()</strong></code> 方法返回一个该对象的字符串表示。此方法被用于派生对象为了特定语言环境的目的(locale-specific purposes)而重载使用。</p> -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre class="syntaxbox"><code><var>obj</var>.toLocaleString();</code> </pre> @@ -21,7 +21,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/toLocaleString <p>表示对象的字符串。</p> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p>{{jsxref("Object")}} <code>toLocaleString</code> 返回调用 {{jsxref("Object.toString", "toString()")}} 的结果。</p> @@ -71,7 +71,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/toLocaleString <p>{{Compat("javascript.builtins.Object.toLocaleString")}}</p> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li>{{jsxref("Object.prototype.toString()")}}</li> 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> diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/valueof/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/valueof/index.html index 82d2bc61d9..1067350917 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/object/valueof/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/object/valueof/index.html @@ -11,7 +11,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/valueOf <p><code><strong>valueOf()</strong></code> 方法返回指定对象的原始值。</p> -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre>object.valueOf()</pre> @@ -19,7 +19,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/valueOf <p>返回值为该对象的原始值。</p> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p>JavaScript调用<code>valueOf</code>方法将对象转换为原始值。你很少需要自己调用<code>valueOf</code>方法;当遇到要预期的原始值的对象时,JavaScript会自动调用它。</p> |