JavaScript Set add() methodThe JavaScript Set add() method is used to add a new object to the end of a WeakSet object. SyntaxThe add() method is represented by the following syntax: Parametervalue - It represents the object to be added. ReturnThe WeakSet object. JavaScript Set add() method exampleHere, we will understand add() method through various examples. Example 1Let's see an example to add object to WeakSet object. Test it NowOutput: true true Example 2In this example, we will see whether we add the objects to WeakSet object without initializing them. Test it NowOutput: ReferenceError: obj is not defined Next TopicWeakSet delete() Method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India