Javascript - String constructor Property

In JavaScript, the constructor property returns the constructor function for an object.

Description

In JavaScript, the constructor property returns the constructor function for an object.

The return value is a reference to the function:

For JavaScript strings the constructor property returns function String() { [native code] }

Syntax

string.constructor

Return

function String() { [native code] }

Example

The constructor property returns the string's constructor function:

Demo

var str = "Hello World!";
console.log(str.constructor);

Result