121
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.
Output:
jQuery AngularJS Bootstrap
Example 2
Let’s see an example to determine the result when WeakMap object doesn?t contain the key.
Output:
undefined
Next TopicWeakMap has() Method