Es6 (ECMAScript 6) introduced two data types let and const for the variable declaration. var data type is a part of Es5(ECMAScript 5).
var is used for function scoped and let is used for block scoped.
example:- for(let i=0;i<10;i++){
console.log(i);
}
console.log(i);
Output:- 0,1,2,....,9
Output:- throws an error as "i is not defined" because i is not visible