• JavaScript Video Tutorials

JavaScript Number - constructor()



Description

It returns a reference to the Number function that created the instance's prototype.

Syntax

Its syntax is as follows −

number.constructor()

Return value

Returns the function that created this object's instance.

Example

<html>
   <head>
      <title>JavaScript constructor() Method</title>
   </head>
   
   <body>      
      <script type = "text/javascript">
         var num = new Number( 177.1234 );
         document.write("num.constructor() is : " + num.constructor); 
      </script>   
   </body>
</html>

Output

num.constructor() is : function Number() { [native code] }
javascript_number_object.htm
Advertisements