Parameters: It accepts a parameter “key” which is the key of the element which is going to be returned from the object weakmap.
Return values: It returns the element which is associated with the particular key in the WeakMap object and it returns undefined if the key can not be found.
Here output is undefined because the key “key1” has not been set at the end of the weakMap object.
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.