Q10: How does Prototypal Inheritance work in JavaScript?
Objects in JavaScript have an internal [[Prototype]] link (exposed as __proto__). When accessing a property on an object, JavaScript looks at the object first, then traverses up the prototype chain until the property is found or null is reached.
Key Takeaways
- Objects inherit properties and methods dynamically via prototype delegation.
- Top of the prototype chain ends at
Object.prototype.__proto__ === null.
Knowledge Check
What method creates a new object using an existing object as its prototype?