Prototype & Inheritance — JavaScript Deep Dive
This repository contains a collection of small,
focused code snippets exploring constructor functions, prototype chains, method overriding,
Object.setPrototypeOf
, Object.create
, and class inheritance in JavaScript.
Topics Covered
- Creating objects with prototypes
- Understanding
__proto__
vs[[Prototype]]
- Prototype inheritance with ES6 classes
- Method overriding
- Changing an object's prototype dynamically
- Checking prototype relationships
- Using
Object.setPrototypeOf
to modify chains
Notes
- All examples include detailed comments and clear explanations in the code.
- These examples are written for educational purposes.
- Each file is independent — you can run them in any order in node.js.
- The goal is to understand how prototypes and inheritance work in JavaScript by seeing small, isolated behaviors.