Map.prototype.values()
O método values()
retorna um novo objeto Iterator que contém os valores de cada elemento do objeto Map
em ordem de inserção.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
Sintaxe
meuMap.values()
Valor de retorno
Um novo objeto iterador do Map
.
Exemplos
Usando o values()
var meuMap = new Map();
meuMap.set('0', 'foo');
meuMap.set(1, 'bar');
meuMap.set({}, 'baz');
var mapIter = myMap.values();
console.log(mapIter.next().value); // "foo"
console.log(mapIter.next().value); // "bar"
console.log(mapIter.next().value); // "baz"
Especificações
Especificação | Status | Comentário |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Map.prototype.values' in that specification. |
Padrão | Initial definition. |
ECMAScript (ECMA-262) The definition of 'Map.prototype.values' in that specification. |
Padrão em tempo real |
Compatibilidade de navegadores
BCD tables only load in the browser