C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript WeakMap has() methodThe JavaScript WeakMap has() method indicates whether the ?WeakMap object contains the specified key. It returns true if the specified key is present, otherwise false. SyntaxThe has() method is represented by the following syntax: WeakMapObj.has(key) Parameterkey - It represents the key to be searched. ReturnA Boolean value. JavaScript WeakMap has() method exampleLet's see an example to determine whether the WeakMap object contains the specified key. <script> var wm = new WeakMap(); var obj1 = {}; var obj2 = {}; var obj3= {}; wm.set(obj1, "jQuery"); wm.set(obj2, "AngularJS"); wm.set(obj3,"Bootstrap"); document.writeln(wm.has(obj2)); </script> Output: true
Next TopicWeakMap set() Method
|