
42 IDiscovering
3.5.5 Prototypal Objects
JavaScript is an object-oriented language, but does not use classes for inheritance. In-
stead, every object has a prototype object, and if a particular requested property is not
defined on an object, the prototype is checked next, then the prototype’s prototype,
and so on. The benefit is that data or functions can be declared on a prototype and
shared by many object instances that share that same prototype.
The easiest mechanism for creating objects that share a prototype is the use of
constructor functions. A constructor function is no different from any other func-
tion, except that it is invoked using the