JavaScript - WeakMap Constructor Property
The JavaScript WeakMap Constructor property is used to return the constructor function for the weakmap object. For JavaScript WeakMaps the constructor property returns: function WeakMap() { [native code] }.
The WeakMap constructor's return value is a reference value to the function, not the name of the function.
Syntax
Following is the syntax of JavaScript WeakMap Constructor property −
weakmap.constructor
Here, weakmap is a weakmap.
Return value
This property returns the constructor function for the specified weakmap.
Example
The following example demonstrates the basic usage of JavaScript WeakMap constructor property −
<html>
<body>
<script>
const myWeakMap = new WeakMap();
const constructor = myWeakMap.constructor;
document.write(constructor);
</script>
</body>
</html>
If we execute the above program, it returns the constructor function for the provided weakmap.