Javascript Map values()

Introduction

The Javascript Map values() method returns a new Iterator object for the values in Map object.

It maintains in insertion order.

myMap.values()

Using values()

var myMap = new Map();
myMap.set('0', 'foo');
myMap.set('key', 'foo');
myMap.set(1, 'bar');
myMap.set(1, 'one');
myMap.set({}, 'baz');

var mapIter = myMap.values();

console.log(mapIter.next().value); //from   ww w. j  a v a  2 s .  c om
console.log(mapIter.next().value); 
console.log(mapIter.next().value); 
console.log(mapIter.next().value); 
console.log(mapIter.next().value); 



PreviousNext

Related