โ— Shell
clean mode source โ†—

JavaScript String - constructor Property



Description

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

Syntax

Its syntax is as follows โˆ’

string.constructor

Return Value

Returns the function that created this object's instance.

Example

Try the following 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>

Output

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

javascript_strings_object.htm