Friday, September 19, 2025
HomeLanguagesJavascriptTypeScript | String Constructor Property

TypeScript | String Constructor Property

The Constructor Property() in TypeScript which is used to returns a reference to the String function that created the object. 
Syntax:

string.constructor 

Return Value: This method returns the reference to the String function that created the object. 
Below example illustrate the  String Constructor Property in TypeScript

 Example 1: 

JavaScript




<script>
    // Original strings
    var str = "Geeksforneveropen - Best Platform"
   
    // use of Constructor Property
    var newstr = str.constructor 
    console.log("Return Value of constructor property:", newstr);
</script>


Output: 

Return Value of constructor property: function String() { [native code] }

Example 2: 

JavaScript




<script>
    // Original strings
    var str = new String("TypeScript - String Constructor Property"); 
   
    // use of Constructor Property
    var newstr = str.constructor 
    console.log(newstr);
</script>


Output: 

function String() { [native code] }
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
32301 POSTS0 COMMENTS
Milvus
84 POSTS0 COMMENTS
Nango Kala
6666 POSTS0 COMMENTS
Nicole Veronica
11840 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11898 POSTS0 COMMENTS
Shaida Kate Naidoo
6781 POSTS0 COMMENTS
Ted Musemwa
7056 POSTS0 COMMENTS
Thapelo Manthata
6739 POSTS0 COMMENTS
Umr Jansen
6745 POSTS0 COMMENTS