|
|
|
|
|
by yakshaving_jgt
2150 days ago
|
|
It's not useful to describe the behaviour of "pointers" in JavaScript, because JavaScript does not have pointers[0]. 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 |
|
Point the OP was getting at: 'const' gives you an immutable reference to a mutable value because it is a modifier for the reference and not the value.
Yes, the article you linked was unambiguous, but for another question :)
As i said, a lot of langugaes (I don't know any that behaves differently) uses the const/final modifiers in this way.
In my experience with people that are just learning how to code, it is a more efficient to point out what is the 'const' modifier making a constant of, than pointing out what it does not do, because the latter sometimes sends a message that the 'const' is useless as it 'does not do anything'.