The WeakSet has() method checks if a WeakSet object contains the specified object element.
Syntax:
weakSetObj.has(value)
Parameters:
value: It represents the element to be searched.
Returns:
It returns true if a specified element is found in the WeakSet Object, otherwise returns false.
Example:
<!DOCTYPE html> <html> <body> <script> var hello = new WeakSet(); var obj={}; hello.add(obj); document.writeln(hello.has(obj)); hello.delete(obj); document.writeln(hello.has(obj)); </script> </body> </html>