aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/conflicting/web/javascript/reference/global_objects/map/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/conflicting/web/javascript/reference/global_objects/map/index.html')
-rw-r--r--files/zh-cn/conflicting/web/javascript/reference/global_objects/map/index.html132
1 files changed, 132 insertions, 0 deletions
diff --git a/files/zh-cn/conflicting/web/javascript/reference/global_objects/map/index.html b/files/zh-cn/conflicting/web/javascript/reference/global_objects/map/index.html
new file mode 100644
index 0000000000..c05822ebf3
--- /dev/null
+++ b/files/zh-cn/conflicting/web/javascript/reference/global_objects/map/index.html
@@ -0,0 +1,132 @@
+---
+title: Map.prototype
+slug: conflicting/Web/JavaScript/Reference/Global_Objects/Map
+translation_of: Web/JavaScript/Reference/Global_Objects/Map
+translation_of_original: Web/JavaScript/Reference/Global_Objects/Map/prototype
+original_slug: Web/JavaScript/Reference/Global_Objects/Map/prototype
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>Map</strong></code><strong><code>.prototype</code></strong> 属性表示 {{jsxref("Map")}}构造函数的原型对象。</p>
+
+<div>{{js_property_attributes(0,0,0)}}</div>
+
+<h2 id="描述">描述</h2>
+
+<p>{{jsxref("Map")}} 实例继承自{{jsxref("Map.prototype")}}。你可以使用这个构造函数的原型对象来给所有的Map实例添加属性或者方法。</p>
+
+<h2 id="属性">属性</h2>
+
+<dl>
+ <dt><code>Map.prototype.constructor</code></dt>
+ <dd>返回一个函数,它创建了实例的原型。默认是{{jsxref("Map")}}函数。</dd>
+ <dt>{{jsxref("Map.prototype.size")}}</dt>
+ <dd>返回Map对象的键/值对的数量。</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{jsxref("Map.prototype.clear()")}}</dt>
+ <dd>移除Map对象的所有键/值对 。</dd>
+ <dt>{{jsxref("Map.delete", "Map.prototype.delete(key)")}}</dt>
+ <dd>如果 <code>Map</code> 对象中存在该元素,则移除它并返回<em> <code>true</code></em>;否则如果该元素不存在则返回 <code><em>false</em></code>。随后调用 <code>Map.prototype.has(key)</code> 将返回 <code>false</code> 。</dd>
+ <dt>{{jsxref("Map.prototype.entries()")}}</dt>
+ <dd>返回一个新的 <code>Iterator</code> 对象,它按插入顺序包含了Map对象中每个元素的 <strong><code>[key, value]</code></strong> <code><strong>数组</strong></code>。</dd>
+ <dt>{{jsxref("Map.forEach", "Map.prototype.forEach(callbackFn[, thisArg])")}}</dt>
+ <dd>按插入顺序,为 <code>Map</code>对象里的每一键值对调用一次callbackFn函数。如果为forEach提供了thisArg,它将在每次回调中作为this值。</dd>
+ <dt>{{jsxref("Map.get", "Map.prototype.get(key)")}}</dt>
+ <dd>返回键对应的值,如果不存在,则返回undefined。</dd>
+ <dt>{{jsxref("Map.has", "Map.prototype.has(key)")}}</dt>
+ <dd>返回一个布尔值,表示Map实例是否包含键对应的值。</dd>
+ <dt>{{jsxref("Map.prototype.keys()")}}</dt>
+ <dd>返回一个新的 <code>Iterator</code>对象, 它按插入顺序包含了Map对象中每个元素的<strong>键 </strong>。</dd>
+ <dt>{{jsxref("Map.set", "Map.prototype.set(key, value)")}}</dt>
+ <dd>设置Map对象中键的值。返回该Map对象。</dd>
+ <dt>{{jsxref("Map.prototype.values()")}}</dt>
+ <dd>返回一个新的<code>Iterator</code>对象,它按插入顺序包含了Map对象中每个元素的<strong>值</strong> 。</dd>
+ <dt>{{jsxref("Map.@@iterator", "Map.prototype[@@iterator]()")}}</dt>
+ <dd>返回一个新的<code>Iterator</code>对象,它按插入顺序包含了Map对象中每个元素的 <strong><code>[key, value]</code></strong> <code><strong>数组</strong></code>。</dd>
+</dl>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-map.prototype', 'Map.prototype')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-map.prototype', 'Map.prototype')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>38</td>
+ <td>{{ CompatGeckoDesktop("13") }}</td>
+ <td>11</td>
+ <td>25</td>
+ <td>7.1</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatNo}}</td>
+ <td>38</td>
+ <td>{{CompatGeckoMobile("13")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>
+ <p>8</p>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="相关链接">相关链接</h2>
+
+<ul>
+ <li>{{jsxref("Set.prototype")}}</li>
+</ul>