What is the difference between let and const in JavaScript?
let allows reassignment; const does not. Both are block-scoped and in the TDZ until their declaration line. const must be initialized at declaration; let can be declared without a value (it gets undefined).
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in let and const in JavaScript: A Complete Guide
No. const prevents reassignment of the variable, but you can still mutate the object's properties. Use Object.freeze() for true immutability.
Memory is allocated for them (so technically yes), but they sit in the Temporal Dead Zone until the declaration line. Accessing them before the line throws ReferenceError, unlike var which is hoisted with undefined.
No. Redeclaring let or const in the same scope throws SyntaxError: Identifier 'x' has already been declared. var allows re-declaration silently, which is one reason to avoid var.
Still have questions?
Browse all our FAQs or reach out to our support team
