Open In App

JavaScript WeakMap constructor Property

JavaScript WeakMap constructor property is used to return the WeakMap constructor function for the object. The function returned by this property is just the reference, not the actual WeakMap. It is an object property of JavaScript and can be used with Strings, Numbers, etc.

Syntax:



weakset.constructor

Return Type: WeakMap() { [native code] }

Below examples will illustrate the WeakSet Constructor Property:



Example 1: In this example, we will see the basic use of WeakSet Constructor Property in JavaScript.




function fun(){
    let x = new WeakMap();
    console.log(x.constructor)
}
fun();

Output:

ƒ WeakMap() { [native code] }

Example 2: In this example, we will use this property to print on the browser window




function myGeeks() {
    let looseSet = new WeakMap();
 
    console.log(looseSet.constructor);
}
myGeeks()

Output
[Function: WeakMap]

Supported Browsers:

We have a complete list of Javascript WeakMap methods, to check those please go through Javascript WeakMap Reference article

Article Tags :