const stands for constant, and it means the variable cannot be reassigned at a later time.

let is similar to var except that it is block scoped, which means it can be declared inside of a for loop and will be local to the body of that for loop (and therefor does not exist outside of it)

The latter is different from a var variable which can be declared anywhere but is always local to the function scope.

In general it is good practice to try and define your variables as const as much as possible.

Answer from vileRaisin on Stack Overflow
🌐
TypeScript
typescriptlang.org › docs › handbook › variable-declarations.html
TypeScript: Documentation - Variable Declaration
In other words, they have the same scoping rules as let, but you can’t re-assign to them. This should not be confused with the idea that the values they refer to are immutable. ... Unless you take specific measures to avoid it, the internal state of a const variable is still modifiable. Fortunately, TypeScript ...
Discussions

TypeScript/ES2015: Prefer `const` instead of `let` reduces readability?
ES2015 introduced the let and const keywords, which essentially have the same semantics apart from reassignment. (const can be seen as a final variable in languages like Java.) I see the point of More on softwareengineering.stackexchange.com
🌐 softwareengineering.stackexchange.com
JS <> const vs let = should I always use const?
It's not a matter of preference, rcommended, or ideal programming style. const and let have their own purpose. One is not absolute better than the other. It would depend on whether the contained (direct) value may be changed or not; or whether it needs to be protected from being changed or not - either by your own code, or by others' code which you don't have control of. If neither doesn't matter, there's no difference betwen using const or let. More on reddit.com
🌐 r/learnprogramming
14
8
November 6, 2022
var, const, let
Rule of thumb: start with const, if you need to change the value later, change to let, and forget about var. More on reddit.com
🌐 r/typescript
23
9
April 24, 2018
const vs let with symbol assignment
TypeScript is a language for application-scale JavaScript development. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ... let letSymbol1 = Symbol('letSymbol1'); // symbol const letSymbol1 = Symbol('letSymbol1'); // Symbol('off') More on reddit.com
🌐 r/typescript
4
10
January 1, 2024
🌐
Medium
medium.com › @robinviktorsson › understanding-the-differences-between-var-let-and-const-in-javascript-and-typescript-0ddd90c0b672
Understanding the Differences Between var, let, and const in JavaScript and TypeScript 💻 | by Robin Viktorsson | Medium
March 10, 2025 - ... Use var only if you are working ... rare in modern JavaScript/TypeScript). Use let when you need a block-scoped variable that can be reassigned, especially within loops or conditions....
🌐
Tutorial Teacher
tutorialsteacher.com › typescript › typescript-variable
TypeScript Variable Declarations: var, let, const
This increases the code readability and maintainability. Variables can be declared using const similar to var or let declarations. The const makes a variable a constant where its value cannot be changed.
🌐
Total TypeScript
totaltypescript.com › let-and-const
How let and const Work In TypeScript | Total TypeScript
February 26, 2024 - So, TypeScript uses how JavaScript works to its advantage. This will often encourage you to use const over let when declaring variables, as it's a little stricter.
Top answer
1 of 2
5

*sigh*... This is why immutable needs to be the default. Even the referenced Java answer suggests this. Note that that answer does not recommend removing final modifiers, just that the author of that answer wouldn't add them in new code (for local variables) because they "clutter up" the code.

However, there is a difference between JavaScript and Java here. In Java, final is an additional modifier on a variable declaration, so you get:

final int foo = 3; // versus
int foo = 3;

In JavaScript, though, const is just an alternate variable declaration, so the situation is:

var foo = 3; // (or let nowadays) versus
const foo = 3;

I don't think two more characters constitutes "clutter". If the alternative being suggested is just foo = 3 then the reviewers are just wrong.

Personally, I would always use const when applicable and would suggest it's inclusion in a code review. But then I'm a Haskeller, so I would be like that. But also, JavaScript tends to be more pervasively mutable and have a worse debugging story when things do unexpectedly change, that I would say const in JavaScript is more valuable than final in Java (though it's still valuable there.)

As Ixrec points out, const only controls the modifiability of the binding, not the object that is bound. So it's perfectly legal to write:

const foo = { bar: 3 };
foo.bar = 5;

This can be used as an argument against using const as someone may be surprised when an "unmodifiable" object is modified. Newer versions of JavaScript do have a mechanism to actually make objects unmodifiable, namely Object.freeze. It makes a good addition to const (though only use it on objects that you create, for example, as Object.freeze({ ... })). This combination will communicate and enforce your intent. If used consistently, the times where you are mutating things will stick out and clearly signal non-trivial data flow.

2 of 2
0

It is indeed good practice to declare variables as const (or readonly or final, depending on the language) if possible.

The author of the linked answer also admits that is is right to mark variables as final, but the author is simply too lazy to do it.

Even if the authors opinion about "clutter" was right, then it wouldn't apply to JavaScript or TypeScript, since const is instead of let, not in addition to.

Find elsewhere
🌐
freeCodeCamp
freecodecamp.org › news › var-let-and-const-whats-the-difference
Var, Let, and Const – What's the Difference?
April 2, 2020 - Unlike var which is initialized as undefined, the let keyword is not initialized. So if you try to use a let variable before declaration, you'll get a Reference Error. Variables declared with the const maintain constant values.
🌐
Overreacted
overreacted.io › on-let-vs-const
On let vs const — overreacted
December 22, 2019 - This turned out to be very controversial, sparking conversations on Twitter and Reddit. It seems that the majority view (or at least, the most vocally expressed view) is that one should use const wherever possible, only falling back to let where necessary, as can be enforced with the prefer-const ESLint rule.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › difference-between-var-let-and-const-keywords-in-javascript
Difference between var, let and const keywords in JavaScript - GeeksforGeeks
This happens because let variables are hoisted but not initialized, so they remain in the TDZ until the declaration is executed. ... Hoisting with const: The variable x is declared with const, which is block-scoped and not hoisted.
Published   January 16, 2026
🌐
W3Schools
w3schools.com › js › js_let.asp
W3Schools.com
ES6 introduced the two new JavaScript keywords: let and const.
🌐
Medium
medium.com › @iamsounak01 › understanding-let-const-and-var-in-typescript-a-beginners-guide-with-examples-e99ab6c6fc62
Understanding let, const, and var in TypeScript: A Beginner's Guide with Examples | by Sounak Das | Medium
November 8, 2024 - Explanation: Here, age is declared with let inside the if block, so it’s only accessible within that block. Trying to access age outside the block will throw an error, as it’s out of scope. const is similar to let in that it’s also block-scoped.
🌐
Quora
quora.com › I-just-started-learning-Typescript-but-Im-still-not-sure-about-one-of-its-basic-concepts-Whats-the-difference-between-let-and-const
I just started learning Typescript, but I'm still not sure about one of its basic concepts. What's the difference between 'let' and 'const'? - Quora
Answer (1 of 4): “let” and “const” are theoretically different keywords. First of all they are belongs to new javascript ES standard. Not particularly typescript. both let and const keywords use for variable scoping and behave same except ...
🌐
GreatFrontEnd
greatfrontend.com › questions › quiz › what-are-the-differences-between-variables-created-using-let-var-or-const
What are the differences between JavaScript variables created using `let`, `var` or `const`? | Quiz Interview Questions with Solutions
September 5, 2021 - In modern JavaScript, it's generally recommended to use const by default for variables that don't need to be reassigned. This promotes immutability and prevents accidental changes. Use let when you need to reassign a variable within its scope.
🌐
Mimo
mimo.org › glossary › typescript › let
TypeScript Let: Syntax, Usage, and Examples
With let, both mutation and reassignment are allowed. That’s not the case with const, which doesn’t allow reassignment (though mutation is still possible). The TypeScript let vs var comparison almost always favors let.
🌐
Slideshare
slideshare.net › home › technology › 9. es6 | let and const | typescript | javascript
9. ES6 | Let And Const | TypeScript | JavaScript | PPTX
It explains that 'let' allows block-level scope for variables, preventing duplicates, while 'const' defines constants that cannot be modified and also follows block-level scope. Syntax examples for both 'let' and 'const' are included along with ...
🌐
LinkedIn
linkedin.com › pulse › what-main-differences-between-let-const-var-keywords-js-pascal-allau
What are the main differences between the 'let', 'const' and 'var' keywords in JS ?
June 15, 2023 - In summary, `var` is used to declare variables with function or global scope, `let` is used to declare variables with block scope and reassignable value, while `const` is used to declare variables with block scope and constant (read-only) value.
🌐
TypeScript
typescriptlang.org › docs › handbook › 2 › everyday-types.html
TypeScript: Documentation - Everyday Types
One way to think about this is to consider how JavaScript comes with different ways to declare a variable. Both var and let allow for changing what is held inside the variable, and const does not. This is reflected in how TypeScript creates types for literals.