Which keyword is used to declare a block-scoped variable that can be reassigned?

The story behind the answer

The keyword used to declare a block-scoped variable that can be reassigned is let.

A variable declared with let belongs to the nearest block, such as the body of an if statement, loop, or pair of braces. Its binding can later receive a new value, so count declared with let may be incremented or otherwise reassigned. The declaration itself cannot be accessed before its declaration is evaluated because it is in the temporal dead zone.

const is also block-scoped, but its binding cannot be reassigned after initialization. var can be reassigned, yet it is function-scoped rather than block-scoped and has older hoisting behavior. static is not the JavaScript keyword for this general variable declaration pattern.

let and const were introduced with ECMAScript 2015, also called ES6, giving JavaScript clearer lexical scoping. Reassignment of a let binding is different from mutating an object stored in a const binding: const object = {}; object.x = 1 is allowed, but assigning a new object to object is not.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: