Google News
logo
UI Developer - Interview Questions
What is the key difference between Class and Prototype-based inheritance?
The most important difference between class-based and prototype-based inheritance is that a class defines a type that can be instantiated at runtime. On the other hand, a prototype is itself an object instance. In JavaScript, the object system is prototype-based, not class-based. That's why inheritance in JavaScript is different from other programming languages.
 
Objects are just a collection of name and value pairs in JavaScript. In JavaScript inheritance, there is only one construct, called object. Every object has private property linked to another object known as its prototype.
Advertisement