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/operators/instanceof | |
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/operators/instanceof')
-rw-r--r-- | files/zh-cn/web/javascript/reference/operators/instanceof/index.html | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/files/zh-cn/web/javascript/reference/operators/instanceof/index.html b/files/zh-cn/web/javascript/reference/operators/instanceof/index.html index 9bc5622462..f8c5807b3c 100644 --- a/files/zh-cn/web/javascript/reference/operators/instanceof/index.html +++ b/files/zh-cn/web/javascript/reference/operators/instanceof/index.html @@ -18,11 +18,11 @@ translation_of: Web/JavaScript/Reference/Operators/instanceof -<h2 id="Syntax" name="Syntax">语法</h2> +<h2 id="Syntax">语法</h2> <pre><code><em>object</em> instanceof <em>constructor</em></code></pre> -<h3 id="Parameters" name="Parameters">参数</h3> +<h3 id="Parameters">参数</h3> <dl> <dt><code>object</code></dt> @@ -34,7 +34,7 @@ translation_of: Web/JavaScript/Reference/Operators/instanceof <dd>某个构造函数</dd> </dl> -<h2 id="Description" name="Description">描述</h2> +<h2 id="Description">描述</h2> <p><code>instanceof</code> 运算符用来检测 <code>constructor.prototype </code>是否存在于参数 <code>object</code> 的原型链上。</p> @@ -79,9 +79,9 @@ o3 instanceof C; // true 因为 C.prototype 现在在 o3 的原型链上 <div class="note"><strong>Mozilla开发者注意:</strong><br> 在代码中使用 XPCOM <code>instanceof </code>有特殊影响: 如果查询接口成功执行后,<code>obj instanceof </code><em><code>xpcomInterface</code></em> (e.g. <code>Components.interfaces.nsIFile</code>) 调用<code>obj.QueryInterface(<em>xpcomInterface</em>)</code> 并且返回 <code>true</code> 。这种调用的副作用是在一次成功的 <code>instanceof</code> 测试后,你可以在 <code>obj</code> 上使用<code>xpcomInterface</code> 的属性。这与标准的 <code>JavaScript</code> 全局变量不同,即使 <code>obj</code> 来自不同的作用域,<code>obj instanceof xpcomInterface</code> 也可以按预期产生作用。</div> -<h2 id="Examples" name="Examples">示例</h2> +<h2 id="Examples">示例</h2> -<h3 id="Example_Demonstrating_that_String_and_Date_are_of_type_Object" name="Example:_Demonstrating_that_String_and_Date_are_of_type_Object">演示 <code>String</code> 对象和 <code>Date</code> 对象都属于 <code>Object</code> 类型和一些特殊情况</h3> +<h3 id="Example_Demonstrating_that_String_and_Date_are_of_type_Object">演示 <code>String</code> 对象和 <code>Date</code> 对象都属于 <code>Object</code> 类型和一些特殊情况</h3> <p>下面的代码使用了 <code>instanceof</code> 来证明:<code>String</code> 和 <code>Date</code> 对象同时也属于<code>Object</code> 类型(他们是由 <code>Object</code> 类派生出来的)。</p> @@ -109,7 +109,7 @@ myDate instanceof Date; // 返回 true myDate instanceof Object; // 返回 true myDate instanceof String; // 返回 false</pre> -<h3 id="Example_Demonstrating_that_mycar_is_of_type_Car_and_type_Object" name="Example:_Demonstrating_that_mycar_is_of_type_Car_and_type_Object">演示 <code>mycar</code> 属于 <code>Car</code> 类型的同时又属于 <code>Object</code> 类型</h3> +<h3 id="Example_Demonstrating_that_mycar_is_of_type_Car_and_type_Object">演示 <code>mycar</code> 属于 <code>Car</code> 类型的同时又属于 <code>Object</code> 类型</h3> <p>下面的代码创建了一个类型 <code>Car</code>,以及该类型的对象实例 <code>mycar</code>. <code>instanceof</code> 运算符表明了这个 <code>mycar</code> 对象既属于 <code>Car</code> 类型,又属于 <code>Object</code> 类型。</p> @@ -174,7 +174,7 @@ var b = mycar instanceof Object; // 返回 true <p>{{Compat("javascript.operators.instanceof")}}</p> -<h2 id="See_also" name="See_also">相关链接</h2> +<h2 id="See_also">相关链接</h2> <ul> <li><a href="/zh-CN/docs/JavaScript/Reference/Operators/typeof" title="/zh-CN/docs/JavaScript/Reference/Operators/typeof">typeof</a></li> |