WeakSet delete() JavaScript

The WeakSet delete() method deletes or removes an element from the WeakSet object.

Syntax:

weakSetObj.delete(value)

Parameters: value: It represents the element to be deleted.

Returns: It returns true if the specified element is removed successfully from the WeakSet Object, otherwise returns false.

Example 1:

<!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>
Please follow and like us:
Content Protection by DMCA.com