Execution Contexts, Hoisting, Scopes, and Closures are fundamental concepts in JavaScript programming language.

Screenshot from https://ui.dev/ course and it were called “Tyler”

Screenshot from https://ui.dev/ course and it were called “Tyler”

Closures

Closures are created when a function is defined inside another function. The inner function creates a closure with its parent function.

When a program starts, the window object is created, along with the this keyword that references the window, and the functions and variables that exist.

When a function is called, a function context is created. Instead of creating the window object, the arguments object is created. If a function or an arrow function is used, a different context is created.

Functions have a scope, and a function inside another function is a closure.

When a program is initiated, the window object is created, along with the this keyword that references the window, and the functions and variables that exist.

When a function is called, a function context is created. Instead of creating the window object, the arguments object is created. If a function or an arrow function is used, a different context is created.

Functions have a scope and a function inside another function is a closure.