List down the collection of methods available on WeakSet

Posted by Jennifer | Updated on

Below are the list of methods available on WeakSet,

  1. add(value): A new object is appended with the given value to the weakset
  2. delete(value): Deletes the value from the WeakSet collection.
  3. has(value): It returns true if the value is present in the WeakSet Collection, otherwise it returns false.
  4. length(): It returns the length of weakSetObject Let’s see the functionality of all the above methods in an example,


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers