var div=new Div(300,250,100,100,5,'00f'); div.display(); alert(div.constructor);
As you can appreciate, the above example defines the same “Div” function I’ve used across this tutorial for spawning some DIV objects. According to the concepts previously explained, after instantiating a new “Div” object with the corresponding input parameters, it’s possible to use its “constructor” property, which comes in handy for returning the complete definition of the constructor method. The above “alert()” method returns the following output:
As depicted above, the “constructor” property nicely returns the full definition for the object’s constructor, including its distinct properties, in conjunction with the list for each method. Give it a try using different objects, and watch the returning value of this property either when using built-in or user-defined objects. The experience is really instructive. Trust me.
To wrap up
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.