How to Get the Keys of a Map in JavaScript
In this lesson, we will see how to get the keys of a map in JavaScript, sometimes we want to get all the keys of a given map in JavaScript so how can we do that?
The keys() method
To do that we can use the keys() method that returns a Map Iterator Object that contains the keys.
const myMap = new Map([['name','john'],['age',22],['city','london']]);
const mapKeys = myMap.keys();
console.log(mapKeys.next().value);
//name