← All dev blog posts

ES6 additions

10 December 2021

Block Scope

Before ES6 (2015), JavaScript 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.Variables declared inside a { } block cannot be accessed from outside the block: