Javascript Map keys()

Introduction

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

It returns the keys in insertion order of the Map object.

myMap.keys()

Using keys()

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

var mapIter = myMap.keys();

console.log(mapIter.next().value); // w w  w. ja  va  2  s . c  om
console.log(mapIter.next().value); 
console.log(mapIter.next().value); 



PreviousNext

Related