TypeScript | String Constructor Property

Last Updated : 15 Jul, 2025

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 = "Geeksforgeeks - 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] }
Comment

Explore