Copyright © tutorialspoint.com

Javascript String - constructor Property

previous next

Advertisements


Description:

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

Syntax:

string.constructor

Here is the detail of parameters:

Return Value:

Returns the function that created this object's instance.

Example:

<html>
<head>
<title>JavaScript String constructor Method</title>
</head>
<body>
<script type="text/javascript">
   var str = new String( "This is string" );
   document.write("str.constructor is:" + str.constructor); 
</script>
</body>
</html>

This will produce following result:

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

To understand it in better way you can Try it yourself.


previous next

Copyright © tutorialspoint.com