![]() |
WeakRef is a constructor that is built-in for creating a reference to an object in a weak manner that is the WeakRef does not itself keep the object from being garbage collected. The deref() method is a feature of WeakRef cases with which you can determine if the referenced object still exists. SyntaxweakRef.deref(); Parameter:The deref() does not take any parameters. Return type:The deref() returns, the target object referred by WeakRef if it still exists or undefined, if the object has been garbage collected. Approach
Example: The example below shows the JavaScript WeakRef.prototype. def () and check for the object’s existence.
Output Object still exists: Pankaj |
Reffered: https://www.geeksforgeeks.org
JavaScript |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 15 |