JavaScript Interview Question: var vs let vs const and Hoisting
Short answer: var is function-scoped and hoisted with the value undefined . let and const are block-scoped and can't be used before their declaration (the temporal dead zone). const can't be reassigned. Scope if (true) { var a = 1; let b = 2; } console.log(a);...