Javascript — Class and Object
We often come across the terms called Class, Objects, Constructor , new and this in Javascript, Typescript or other programming languages. In common all we need to know is the following.

What is OO (🙂bject 🙂riented) ?
Putting the real world things into objects
To understand this, let’s get into layman’s terms (I am even assuming my self as Layman to understand this thing called OOP, would be better to know).
What is an Object ?
Consider you are travelling with your partner. And you need to submit your personal details. The basic details will be ‘your First name, Last name, Gender, Passport number, Date of travelling, no of people travelling, country etc’.
Now these are the basic details that a Booking site needs from every one. so you fill a form with all these details.
Now you fill all these details in a form, and all forms have same structure with same fields. Here, the common structure of the details is ‘Class’ and the type of details in it are the properties, properties might be of any type such as arrays, boolean, strings, numbers or methods.

The Passenger Class above is a model / proto type which defines all the properties used by as many as passengers who book their travel.
The booking site, here creates a Class with the properties. The booking site expects all the passengers to submit these common details for bookings.
Here each and every Passenger details, is considered as ‘Objects’
Now let’s create an Object with some passenger details :

Here traveller is an Object created for Passenger “Ram”. Similarly, all other passengers creates object of same Class Properties. These objects are then sent across the network for various business processes.
In the above example, you came across some reserved keywords, Let’s go with a little detailing about them :
Class : It’s a blueprint / model used for creating Object.
Constructor : In the above example, An object is created with details of Ram, that instance of Ram (instance of object ) is created by Constructor function.
Constructor is a function that is used for instantiation of objects.
this : it is a keyword used to access the variables inside the class methods.
new : used for creating a new instance of object.
Are you curious to know about the difference between let and var, here’s the link for your query : let vs var
Thats’s all so simple about learning about Class, Object, Constructor, new and this. Hope you liked this article. Please follow for more posts on technical stack.