JavaScript’s let vs. const: The Debate That Doesn’t Really Matter

JavaScript developers have plenty of ways to declare variables, and while var is still functional, let and const have largely become the standard replacements. The real discussion, however, centers on coding style: Should you default to const whenever possible, or only reach for it when reassignment is explicitly forbidden?

Dan Abramov breaks down both sides of this “controversy” in a detailed post, presenting each argument with its own strengths and trade-offs. The first points on each side are particularly striking.

From the pro-const camp:

One Way to Do It: It is mental overhead to have to choose between let and const every time. A rule like “always use const where it works” lets you stop thinking about it and can be enforced by a linter.

From the pro-let perspective:

Loss of Intent: If we force const everywhere it can work, we lose the ability to communicate whether it was important for something to not be reassigned.

Abramov’s ultimate stance is refreshingly pragmatic: “I don’t care.” The choice between let and const is something linters and auto-fixers can handle, much like the tabs-vs.-spaces debate. You can hold an opinion, but automation is what truly governs the day-to-day workflow. The full post lays out five arguments per side, and it’s well worth reading in its entirety.