WeakSet has() JavaScript

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 specified element is found in WeakSet Object, otherwise return 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>

Output:

true false
Please Share