WeakSet add() JavaScript JS

The WeakSet add() method adds a new element to the end of a WeakSet object.

Syntax:

weakSetObj.add(value)

Parameters: value: It represents the element to add.

Returns: Updated WeakSet object.

Example:

<!DOCTYPE html>
<html>
<body>
<script>  
var hello = new WeakSet();  
var obj={};    
hello.add(obj);    
document.writeln(hello.has(obj));   
</script>
</body>
</html>
Please follow and like us:
Content Protection by DMCA.com