C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript WeakSet has() methodThe JavaScript WeakSet has() method indicates whether the WeakSet object contains the specified object. It returns true if the specified object is present, otherwise false. Syntax
The has() method is represented by the following syntax: weakSetObj.has(value) Parameter
value - It represents the object to be searched. ReturnA Boolean value. JavaScript WeakSet has() method example
Let's see an example to determine whether the WeakSet object contains the specified object.
<script>
var ws = new WeakSet();
var obj1={};
var obj2={};
ws.add(obj1);
document.writeln(ws.has(obj1)+"<br>");
document.writeln(ws.has(obj2)+"<br>");
document.writeln(ws.has());
</script>
Output: true false false
Next TopicWeakSet Method
|