Class in Javascript (Object Oriented Program)

Class is a blueprint for creating objects that share a similar structure and behavior.
It defines a set of properties and methods that will be inherited by the objects instantiated from it.

The class keyword was introduced in ES6 as a syntactical sugar to facilitate the creation of object-oriented code.

In the example, we have defined a Car class with a constructor that takes make, model, and year parameters. These parameters are used to initialize the instance variables of the object.

We have also defined a drive method that will be inherited by all objects instantiated from the Car class. The drive method logs a message to the console with the make and model of the car.

To create an object from the Car class, we can use the new keyword and call the Car constructor.
This will create a new Car object with the make 'Audi', model 'A4', and year 2016.

We can then call the drive method on this object.
This will log the message "Driving the Audi A4" in the console.