JavaScript/Inheritance

instanceof operator
The instanceof operator determines whether an object was instantiated as a child of another object, returning true if this was the case. instanceof is a binary infix operator whose left operand is an object and whose right operand is an object type. It returns true, if the left operand is of the type specified by the right operand. It differs from the .constructor property in that it "walks up the prototype chain". If object a is of type b, and <tt>b</tt> is an extension of <tt>c</tt>, then <tt>a instanceof b</tt> and <tt>a instanceof c</tt> both return <tt>true</tt>, whereas <tt>a.constructor === b</tt> returns <tt>true</tt>, while <tt>a.constructor === c</tt> returns <tt>false</tt>.

Inheritance by prototypes
The prototype of an object can be used to create fields and methods for an object. This prototype can be used for inheritance by assigning a new instance of the superclass to the prototype.