MCA
OBJECT-ORIENTED JAVASCRIPT // MASTER THE CONCEPTS // WRITE BRUTAL CODE // OBJECT-ORIENTED JAVASCRIPT // MASTER THE CONCEPTS // WRITE BRUTAL CODE //
BACK TO SYLLABUS
MEDIUM

OBJECT-ORIENTED JAVASCRIPT

Classes, prototypes, and inheritance

CONCEPTS

01Constructor Functions
02Prototypal Inheritance
03ES6 Classes
04Getters and Setters
05Static methods and properties
06The "this" keyword

SYNTAX_DEMO

Structuring complex apps
class Animal {
  constructor(name) {
    this.name = name;
  }
  speak() {
    console.log(`${this.name} makes a noise.`);
  }
}

class Dog extends Animal {
  speak() {
    console.log(`${this.name} barks.`);
  }
}

const d = new Dog("Mitzie");
d.speak(); // Mitzie barks.