|
|
|
|
|
by mhaberl
2150 days ago
|
|
const value can be redeclared in a different scope - but to be very precise; this is not really question of (im)mutability - it is a different value inside a scope, the original value is not changed. Other thing is (and I believe this is what the OP is asking you) - if you say: const a = 1; a will always be 1 (inside the scope). Sure if you say: const o = { a: 1}; you can change the value of a inside the o, but the o (the pointer as the OP is saying) is not changed. I have 0 experience with Elm, but a _lot_ of popular languages have this behaviour for const/final |
|
I think the article I linked to earlier was already sufficiently unambiguous. To clarify once again: If you can mutate a value, then the value is mutable. Mutable means it is not immutable. The `const` keyword in JavaScript does not give you an immutable value.
[0]: https://stackoverflow.com/a/17382443/704015