Object.prototype

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

							object.prototype.property
							object.prototype.method
						

Description

The prototype property of the Object object allows the addition of properties or method to the Object class.

Example

Listing 6.194 shows how the prototype property is used.

Listing 6.194 Example of the prototype Property
<html>
<body>

<script language="JavaScript">
<!––Hide
Object.prototype.newProperty = 2;
document.write(document.object.newProperty.value);
// 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.