๐——๐—ฎ๐˜† ๐Ÿฎ๐Ÿฒ ๐—ผ๐—ณ ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป๐—ถ๐—ป๐—ด ๐— ๐—˜๐—ฅ๐—ก ๐—ฆ๐˜๐—ฎ๐—ฐ๐—ธ

I am on day 26 of my MERN stack journey. Today I moved from prototype manipulation to ES6 Classes and Inheritance.

Yesterday I learned how single objects share methods. Today I learned how to build blueprints for objects. This makes your code scalable.

I studied Object-Oriented Programming (OOP) in JavaScript. Here are the main points:

โ€ข A class acts as a blueprint for your objects. โ€ข The constructor() method runs automatically when you create a new object. โ€ข Use the new keyword to create an instance of a class. โ€ข The constructor is the best place to set initial properties.

Example:

class Car { constructor(brand, hp) { this.brandName = brand; this.horsepower = hp; } }

let myCar = new Car("Toyota", 180);

This method allows you to build many objects quickly using one template.

Source: https://dev.to/ali_hamza_589ec7b3eb6688d/dau-26-of-learning-mern-stack-2j4e