Suggested answer

JavaScript uses prototypal inheritance. Every object has an internal [[Prototype]] link to another object. When a property is accessed, JS traverses the prototype chain until found or reaches null. Object.getPrototypeOf(obj) returns the prototype. Functions have a prototype property — objects created with new Fn() have Fn.prototype as their prototype. Class syntax is syntactic sugar over the prototype chain — it does not introduce a new inheritance model. class Animal { speak() {...} } class Dog extends Animal { speak() { super.speak(); } } — Dog.prototype inherits from Animal.prototype. extends sets up the prototype chain. super() must be called in a subclass constructor before accessing this. In LWC, all components extend LightningElement which provides the component lifecycle APIs.

Practice content for interview preparation; not an official vendor answer. Verify details against current product documentation.

Community comments (0)

No comments yet.

Sign in or create a free account to add a comment. Comments are moderated before they appear.

Plain text only, 3–2000 characters. A moderator reviews every comment before it is published.