Map.prototype.values()

values() 方法返回一个新的Iterator对象。它包含按顺序插入Map对象中每个元素的value值。
 

语法

myMap.values()

返回值

一个新的 Map 可迭代对象.

例子

使用 values()

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"

规范

规范 状态 备注
ECMAScript 2015 (6th Edition, ECMA-262)
Map.prototype.values
Standard 初始定义
ECMAScript Latest Draft (ECMA-262)
Map.prototype.values
Draft  

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 38 20 (20) 未实现 25 7.1
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 未实现 38 20.0 (20) 未实现 未实现 8

查看