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:
- function String() { [native code] }
Example 1: This example shows the basic use of the String constructor Property in 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.
function myGeeks() {
let str = "Hello World!";
console.log(str.constructor);
}
myGeeks()
Output
[Function: String]
Supported Browsers:
The browser supported by the String constructor property are listed below.
- Google Chrome 1
- Edge 12
- Apple Safari 1
- Firefox 1
- Opera 3

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
