CodesJava

Easy learning with example program codes

WeakSet delete() JavaScript

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

Syntax:

weakSetObj.delete(value) 

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

Returns:
It returns true if specified element is removed successfully from WeakSet Object, otherwise return 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>

Output:

true false
Please follow and like us:
error








Copyright © 2019 CodesJava DMCA.com Protection Status