Name some methods of weakMap instances in javascript?

JavascriptFront End TechnologyObject Oriented Programming

Following are some of the methods available on weakMap instances in javaScript −

1. WeakMap.prototype.delete(key)

Removes any value associated to the key. WeakMap.prototype.has(key) will return false afterwards.

2. WeakMap.prototype.get(key)

Returns the value associated to the key, or undefined if there is none.

3. WeakMap.prototype.has(key)

Returns a Boolean asserting whether a value has been associated to the key in the WeakMap object or not.

4. WeakMap.prototype.set(key, value)

Sets the value for the key in the WeakMap object. Returns the WeakMap object.

raja
Published on 16-Sep-2019 08:55:34

Advertisements