Constructor functions, prototypes, and the prototype chain in JavaScript
Before class syntax, constructor functions and prototypes were the main way to share behavior, and that model still exists underneath modern classes.
- Functions can act as constructors
- Shared methods usually live on the prototype
- Property lookup follows the prototype chain
Constructor functions, prototypes, and the prototype chain in JavaScript