ES6 - String constructor property



A constructor returns a reference to the string function that created the instance's prototype.

Syntax

string.constructor

Return Value

Returns the function that created this object’s instance.

Example: String constructor property

var str = new String( "This is string" );
console.log("str.constructor is:" + str.constructor)

Output

str.constructor is:function String() { [native code] }
Advertisements