Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The prototype property is an
object created by JavaScript for every Function() instance. Specifically, it links
object instances created with the new
keyword back to the constructor function that created them. This is done
so that instances can share, or inherit, common methods and properties.
Importantly, the sharing occurs during property lookup. Remember from
Chapter 1 that every time you look up or
access a property on an object, the property will be searched for on the
object as well as the prototype chain.
A prototype object is created for every function, regardless of whether you intend to use that function as a constructor.
Below, I construct an array from the Array() constructor, and then I invoke the
join() method.