JavaScript Map get() method

The JavaScript map get() method returns the value of specified key of an element from a Map object.

Syntax

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

Parameter

key - The key to be searched.

Return

The value of specified key.

JavaScript Map get() method example

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

Example 1

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

Test it Now

Output:

jQuery
AngularJS
Bootstrap

Example 2

Let's see an example to determine the result when map object doesn?t contain the specified key element.

Test it Now

Output:

undefined

Next TopicJavaScript Math




Latest Courses