var vs let vs const in JavaScript: Differences, Hoisting and When to Use Each (Tested Examples)
var is function-scoped and hoisted as undefined; let and const are block-scoped and throw if used before their declaration. const stops reassignment, not mutation. Tested examples of scope, hoisting, the temporal dead zone, loops, globals and every related error message.