Scope of variables in JavaScript

1) Global Scope

2) Local scope

3) Block Scope a) No block scope in JavaScript till ES6.

b) ES6 introduced let

4) Intermediate: Object properties

5) Advanced: Closure

6) Advanced: Prototype-based…

Write a basic Object Oriented JavaScript class

What is closure in JavaScript ?

In JavaScript, if you use the function keyword inside another function, you are creating a closure. The following code returns a reference to a function:

The above code has a closure…