JavaScript Tutorial ✦
var vs let vs const
var has function scope and hoisting; let has block scope; const declares read-only bindings.
function example() {
var a = 1; // Function-scoped
{
let b = 2; // Block-scoped
const c = 3; // Block-scoped
}
}