Loading…
A short voice session: one question, one follow-up, then instant feedback — up to 5 minutes.
let and const have block scope; var has function scope. const prevents reassignment of the binding, while let and var allow it.
A let or const declared inside a block is limited to that block. A var declared inside an ordinary block belongs to the surrounding function, or the top-level environment when no function surrounds it. const must be initialized and cannot be reassigned. It does not freeze an object: const settings = {theme: "dark"}; settings.theme = "light" is valid, but settings = {} is not.