Last Updated : 11 Jul, 2025
The String constructor property in JavaScript is used to return the string constructor function for the object. The function which is returned by this property is just the reference to this function, not a string containing the function's name. The JavaScript number constructor, string constructor, and boolean constructor return function Number() { [native code] }, function String() { [native code] } and function Boolean() { [native code] } respectively.
Syntax:string.constructorReturn Value:
Example 1: This example shows the basic use of the String constructor Property in Javascript.
JavaScript
function func() {
let str = 'Geeks for Geeks';
let value = str.constructor;
console.log(value);
}
func();
Output:
function String() { [native code] }
Example 2: This example uses the String constructor Property of Javascript.
JavaScript
function myGeeks() {
let str = "Hello World!";
console.log(str.constructor);
}
myGeeks()
[Function: String]Supported Browsers:
The browser supported by the String constructor property are listed below.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4