Saturday, December 6, 2025
HomeLanguagesJavascriptJavaScript WeakSet constructor Property

JavaScript WeakSet constructor Property

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

Syntax:

weakset.constructor

Return Type: WeakSet() { [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.

Javascript




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


Output: 

Æ’ WeakSet() { [native code] }

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

HTML




<!DOCTYPE html>
<html lang="en">
 
<head>
    <title>
        JavaScript WeakSet constructor Property
    </title>
</head>
 
<body>
    <h1 style="color:green">
        Welcome to neveropen
    </h1>
 
    <p>
        Click the button to see WeakSet
        constructor property.
    </p>
 
    <button onclick="myGeeks()">
        click me
    </button>
 
    <p id="GFG"></p>
 
    <script>
        function myGeeks() {
            let looseSet = new WeakSet();
 
            document.getElementById("GFG").innerHTML
                = looseSet.constructor;
        }
    </script>
</body>
</html>


Output:

JavaScript WeakSet Constructor property

JavaScript WeakSet Constructor property

Supported Browsers:

  • Google Chrome
  • Firefox
  • Internet Explorer
  • Opera 
  • Safari

We have a complete list of Javascript WeakSet Methods, to check those please go through the JavaScript WeakSet Reference article.

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32427 POSTS0 COMMENTS
Milvus
103 POSTS0 COMMENTS
Nango Kala
6802 POSTS0 COMMENTS
Nicole Veronica
11944 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12012 POSTS0 COMMENTS
Shaida Kate Naidoo
6932 POSTS0 COMMENTS
Ted Musemwa
7185 POSTS0 COMMENTS
Thapelo Manthata
6881 POSTS0 COMMENTS
Umr Jansen
6867 POSTS0 COMMENTS