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: