JavaScript String constructor
Example
Get the constructor of a string:
let message = "Hello World!";
let text = message.constructor;
Try it Yourself »
Description
The constructor
property returns the function that created the String prototype.
For JavaScript strings the constructor
returns:
function String() { [native code] }
Syntax
string.constructor
Return Value
function String() { [native code] } |
Browser Support
constructor
is an ECMAScript1 (ES1) feature.
ES1 (JavaScript 1997) is fully supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |