let and const are introduced in ES2015 (ES6) before that only var was available.
The variables declared by var are function scoped.
The variables declared by let and const are block scoped.
All types of variables will be defined in their entire scope, variables defined by var can be accesses before the line where there are declared, let and const will throw an error in that case.
console.log(a); // undefined var a = 1; console.log(b); // ReferenceError let b = 1;