JavaScript String constructor property

Definition and usage

constructor properties return the function that creates the string prototype.

For JavaScript strings, the constructor returns:

function String() { [native code] }

instance

Get the constructor of the string:

let message = "Hello World!";
let text = message.constructor;

try it yourself

syntax

string.constructor

return value

function String() { [native code] }

browser support

constructor is an ECMAScript1 (ES1) feature.

All browsers fully support ES1 (JavaScript 1997):

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support Support Support Support Support Support

Related Pages

JavaScript String

JavaScript String Methods

JavaScript String Search