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 (JavaScriopt 1997) feature.
It is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |