August 1999
Intermediate to advanced
1488 pages
72h 53m
English
function.prototype.property function.prototype.method
The prototype property of the Function object refers to the object that serves as the prototype from which classes are created. prototype allows you to add new properties of methods to an existing class by adding them to the prototype associated with the constructor of that class.
Listing 6.130 shows how the prototype property is used. The function setTask, which simply sets the "task" variable, is defined. Then a new prototype called duty is created for the String object. The duty prototype is set to call the setTask function. Now all String objects in the example ...
Read now
Unlock full access