JavaScript – hoisting, var, let, const
This post is a quick summary of the differences in JavaScript variable declaration.
Before ES2015 (previously named ES6), there was only one keyword to declare variables: var. The newer standard introduced two extra useful keywords: let and const.
Briefly:
vardeclares “almost global” variablesletdeclares block variablesconstdeclares block read-only variables
Explanation follows.
…