Which keyword declares an unchangeable variable in JavaScript?

The story behind the answer

The `const` keyword declares a variable binding that cannot be reassigned in JavaScript. Once a `const` binding has been initialized, assigning a different value to that binding causes a `TypeError` in strict mode or fails according to the execution context.

`const` was introduced with ECMAScript 2015, commonly called ES6, alongside `let`. Unlike `var`, it is block-scoped, so it exists only inside the pair of braces where it is declared. It must also be initialized at the point of declaration; `const count;` is invalid.

“Unchangeable variable” is useful quiz wording, but `const` does not freeze objects or arrays. A `const` array can still have elements added or removed, and a `const` object can still have properties changed. The binding stays fixed; the referenced value may remain mutable.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: