JavaScript·Beginner·Coding·1 min read
Why prefer const by default?
Short interview answer
const prevents reassignment of the binding, communicates intent, and narrows possible state changes. It does not freeze the referenced object. Use let when the binding itself must change and avoid var in modern application code unless its semantics are specifically required.
Example
const user = { name: 'Ada' };user.name = 'Grace'; // OK — the object is mutableuser = {}; // TypeError — the binding cannot be reassignedKey takeaway
Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.