Table of contents
Classical OOOPS JavaScript
JavaScript is designed to support classical OOPS. However, in ES6 classical OOPS was introduced in JavaScript
Note
- While writing a method/function inside a class it is not compulsory to mention the function keyword as the scope of the function is where it is declared.
- We can access methods outside the class unless they are made private using an instance of the object
- Private members were included in ES6
- this in a class refers to the current of the object of the class 5.Using new keyword an instance of the class can be created
Constructor
This is a special function with keyword constructor Is called automatically the moment we create an The physical object constructor() {
}
Private Members
- Variables and methods can be made private by adding a prefix '#' 2.This means we cannot access them outside the class