Class
Definition
ES6 syntactic sugar over JavaScript's prototype-based inheritance. Classes provide a cleaner way to create objects and implement inheritance using `extends` and `super`.
Code Example
Learn More
Related Terms
Every JavaScript object has a hidden internal property called [[Prototype]] that links to another object. When a property is accessed on an object and not found, JavaScript walks up the prototype chain to find it. This is the basis of JavaScript's inheritance model.
ConstructorA special method inside a class that is called when a new instance is created with the new keyword. It initializes the object's properties and sets up its initial state.
InheritanceA mechanism where a class (child) derives properties and methods from another class (parent). In JavaScript, inheritance is achieved through the prototype chain or the extends keyword with ES6 classes.