javascript constructor attribute
Translation results:
UK [kənˈstrʌktə(r)] US [kən'strʌktə]
n.Constructor
Plural: constructors
javascript constructor attributesyntax
What does the constructor attribute mean?
The constructor exists in the prototype attribute of each function. The constructor attribute returns a reference to the array function that created this object.
Function: Returns a reference to the array function that created this object.
Syntax: object.constructor
Description: The constructor property returns a reference to the array function that created this object.
Comments: None
javascript constructor attributeexample
<html> <body> <script type="text/javascript"> var test=new Array(); if (test.constructor==Array) { document.write("This is an Array"); } if (test.constructor==Boolean) { document.write("This is a Boolean"); } if (test.constructor==Date) { document.write("This is a Date"); } if (test.constructor==String) { document.write("This is a String"); } </script> </body> </html>
Run instance »
Click the "Run instance" button to view the online instance