Javatpoint Logo
Javatpoint Logo

JavaScript Map keys() method

The JavaScript map keys() method returns an object of new Map iterator. This object contains the key for each element. It maintains insertion order.

Syntax

The keys() method is represented by the following syntax:

Return

A new object of Map iterator.

JavaScript Map keys() method example

Here, we will understand keys() method through various examples.

Example 1

Let's see a simple example of keys() method.

Test it Now

Output:

1
2
3

Example 2

Let's see the same example using for loop.

Test it Now

Output:

1
2
3

Next TopicJavaScript Math





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA