Object.constructor

JavaScript 1.1+, Jscript 3.0+ Nav3+, NES2+, IE4+ Syntax

							object.constructor

Description

The constructor property of the Object object specifies the function that creates the object.

Example

Listing 6.192 shows an example of the constructor property.

Listing 6.192 Example Packages constructor Property
<html>
<body>

<script language="JavaScript">
<!-––Hide

// create a new number object using the constructor property
num = new Number(3)
if(num.constructor == Number){
    document.write("Object is created");
}
// End Hide ––>
</script>

</body>
</html>
							
							
						

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.