JavaScript String constructor property

Definition and usage

constructor property returns 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 ECMAScript1 (ES1) feature.

All web browsers fully support ES1 (JavaScript 1997):

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Stöd Stöd Stöd Stöd Stöd Stöd

Relaterade sidor

JavaScript-sträng

JavaScript-strängmetoder

JavaScript-strängsökning