ES6 - Map Method keys


Advertisements

This function returns a new iterator object referring to the keys in the Map.

Syntax

myMap.keys()             

Return Value

Returns an Iterator object

Example

var myMap = new Map(); 
myMap.set("id", "admin"); 
myMap.set("pass", "admin@123"); 

var itr = myMap.keys(); 
console.log(itr.next().value); 
console.log(itr.next().value); 

Output

id 
pass  
es6_collections.htm
Advertisements