JavaScript Scope

Scope determines the accessibility (visibility) of variables.

JavaScript variables have 3 types of scope:

  • Block scope
  • Function scope
  • Global scope

Block Scope

Before ES6 (2015), JavaScript variables had only Global Scope and Function Scope.

ES6 introduced two important new JavaScript keywords: let and const.

These two keywords provide Block Scope in JavaScript. Continue reading JavaScript Scope