Javatpoint Logo
Javatpoint Logo

JavaScript WeakMap get() method

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

Syntax

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

Parameter

key - The key to be searched.

Return

The value of the specified key.

JavaScript WeakMap 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 WeakMap object doesn?t contain the key.

Test it Now

Output:

undefined





Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA