Home >>JavaScript String Methods >JavaScript String constructor Property

JavaScript String constructor Property

What is JavaScript String constructor Property

JavaScript constructor property is used to return the constructor function for an object. The return value of this is a reference to the function and not the name of the function.

Syntax:

string.constructor

Browser Support

Method Chrome Edge Firefox Safari Opera
constructor Yes Yes Yes Yes Yes

Here is an example of constructor property:

<html>
<body>
<p id="demo"></p>
<script>
var str = "Hello World!";
document.getElementById("demo").innerHTML = str.constructor;
</script>
</body>
</html>
Output:
function String() { [native code] }