2019-04-21 11:50:48 +08:00

103 lines
3.9 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<article id="wikiArticle">
<div><code><strong>values()</strong></code> 方法返回一个新的Iterator对象。它包含按顺序插入Map对象中每个元素的value值。</div>
<div> </div>
<h2 id="语法">语法</h2>
<pre><code class="language-javascript"><code><em>myMap</em>.values()</code></code></pre>
<h3 id="返回值">返回值</h3>
<p>一个新的 <a href="https://developer.mozilla.orgReference/Map" title="此页面仍未被本地化, 期待您的翻译!"><code>Map</code></a> 可迭代对象.</p>
<h2 id="例子">例子</h2>
<h3 id="使用_values()"><code>使用 values()</code></h3>
<pre><code class="language-js">var myMap = new Map();
myMap.set("0", "foo");
myMap.set(1, "bar");
myMap.set({}, "baz");
var mapIter = myMap.values();
console.log(mapIter.next().value); // "foo"
console.log(mapIter.next().value); // "bar"
console.log(mapIter.next().value); // "baz"</code></pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">规范</th>
<th scope="col">状态</th>
<th scope="col">备注</th>
</tr>
<tr>
<td><a class="external" href="https://www.ecma-international.org/ecma-262/6.0/#sec-map.prototype.values" hreflang="en" lang="en" rel="noopener">ECMAScript 2015 (6th Edition, ECMA-262)<br/><small lang="zh-CN">Map.prototype.values</small></a></td>
<td><span class="spec-Standard">Standard</span></td>
<td>初始定义</td>
</tr>
<tr>
<td><a class="external" href="https://tc39.github.io/ecma262/#sec-map.prototype.values" hreflang="en" lang="en" rel="noopener">ECMAScript Latest Draft (ECMA-262)<br/><small lang="zh-CN">Map.prototype.values</small></a></td>
<td><span class="spec-Draft">Draft</span></td>
<td> </td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p></p><div class="blockIndicator warning"><strong><a class="external" href="https://github.com/mdn/browser-compat-data" rel="noopener">We're converting our compatibility data into a machine-readable JSON format</a></strong>.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
<strong><a class="new" href="/zh-CN/docs/MDN/Contribute/Structures/Compatibility_tables" rel="nofollow">Find out how you can help!</a></strong></div>
<div class="htab">
<a id="AutoCompatibilityTable" name="AutoCompatibilityTable"></a>
<ul>
<li class="selected"><a>Desktop</a></li>
<li><a>Mobile</a></li>
</ul>
</div><p></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><a href="/en-US/Firefox/Releases/20" title="Released on 2013-04-02.">20</a> (20)</td>
<td><span style="color: #f00;">未实现</span></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><span style="color: #f00;">未实现</span></td>
<td>38</td>
<td>20.0 (20)</td>
<td><span style="color: #f00;">未实现</span></td>
<td><span style="color: #f00;">未实现</span></td>
<td>8</td>
</tr>
</tbody>
</table>
</div>
<h2 id="查看">查看</h2>
<ul>
<li><a href="Reference/Global_Objects/Map/entries" title="entries() ?方法返回一个新的包含 [key, value] ?对的 Iterator ?对象返回的迭代器的迭代顺序与 Map 对象的插入顺序相同。"><code>Map.prototype.entries()</code></a></li>
<li><a href="Reference/Global_Objects/Map/keys" title="keys() 返回一个新的 Iterator 对象。它包含按照顺序插入Map对象中每个元素的key值。"><code>Map.prototype.keys()</code></a></li>
</ul>
</article>