The best practices for JavaScript inheritance are:
- Move all of your methods out of the constructors and into the prototypes.
- Always define all of your properties in the prototype, it helps to document the new "type."
- Always use Object.create to link a new object to the "super-type" prototype, never build an instance of the "super-type" as the new prototype object. And always recreate the constructor property in the prototype.
- And always chain the constructor calls to the "super-type" constructor, even if they do not take any arguments and may not even do anything.
To explain them we are going to start from the beginning: