Below is the example of weakMap.delete() method.
Parameters: It accepts a parameter “key” which is the key of the element which is going to be deleted form the object weakMap.
Return values: It returns true if that element has been deleted from the weakMap object and false if that key is not present in the weakMap object.
Input: weakmap1.delete(key1) Output: true
Here output is true it means that key of the element has been deleted successfully.
Here output is false because the key “key1” with any value has not been set to the end of the weakMap object.
- Chrome 36 and above
- Edge 12 and above
- Firefox 6 and above
- Internet Explorer 11 and above
- Opera 23 and above
- Safari 8 and above