Beej's Bit Bucket
2 days ago
- In JavaScript, prototypal inheritance differs from class-based inheritance: an object's prototype is an implicit reference to its constructor's prototype property.
- If a property isn't found on an object, it's searched for in that object's prototype, and further up the prototype chain until found or exhausted.
- Inheritance can be implemented by setting a constructor's prototype to an instance of another constructor, forming a chain; it's important to fix the constructor property afterward to maintain correct references.