August 1999
Intermediate to advanced
1488 pages
72h 53m
English
Number. prototype.property Number. prototype.method
The prototype property of the Number object allows you to add properties or methods to all instances of this class.
Listing 6.187 shows how the prototype property is used.
<html> <body> <script language="JavaScript"> <!–– Hide // Creates a new Number property myProp var myProp = new Number(); // sample function multiplies number by 3 function triple(num){ var result; result = (num * 3); return result; } // Add the prototype peoperty to the number object Number.prototype.calc3 = triple; document.write("Example demonstrates the prototype property ... |
Read now
Unlock full access