Subjects

All subjects Django Java Python React Spring Boot JavaScript PHP
Sign Up Free
JavaScript 10 questions

Prototypes and Inheritance

Master JS prototype chains. Learn prototypes, custom inheritance patterns, classes, constructor calls, and object instantiation.

More JavaScript
Interview questions 1–10 of 10
1

What is the prototype chain in JavaScript?

Every JavaScript object has an internal link to another object called its prototype. When a property or method...

Read answer →
2

What is the difference between __proto__ and prototype?

PropertyExists onPurposeprototypeFunctions (specifically constructor functions/classes)The object that will be...

Read answer →
3

How does Object.create() work and how is it different from using 'new'?

Object.create() creates a new object with a specified prototype directly, without invoking a constructor funct...

Read answer →
4

How do constructor functions and the 'new' keyword work together?

A constructor function is a regular function used with 'new' to create objects following a consistent template...

Read answer →
5

How do you implement inheritance using prototype-based patterns (before ES6 classes)?

Before ES6, inheritance was implemented by manually linking one constructor's prototype to another's, then cal...

Read answer →
6

What is the difference between instance methods and static methods regarding prototypes?

TypeDefined onCalled onAccesses instance data?Instance methodConstructor.prototypeIndividual instancesYes, via...

Read answer →
7

How does JavaScript handle multiple inheritance or shared behavior across unrelated classes?

JavaScript's prototype chain only supports single inheritance (one prototype per object), but mixins provide a...

Read answer →
8

What is the difference between Object.freeze(), Object.seal(), and Object.preventExtensions()?

MethodAdd new properties?Delete properties?Modify existing values?Object.preventExtensions()NoYesYesObject.sea...

Read answer →
9

How does the 'this' keyword behave differently in prototype methods vs arrow functions defined as class fields?

Regular prototype methods have a dynamic 'this' that depends on how they're called, while arrow functions defi...

Read answer →
10

How can you check an object's prototype chain and determine what an object inherits from?

JavaScript provides several methods to inspect the prototype chain, check inheritance relationships, and list...

Read answer →