|
|
|
|
|
by evincarofautumn
3943 days ago
|
|
How do you mean? All this post is saying is that “const” in JavaScript is the same as “final” in Java—it lets you make immutable references, but not immutable objects. In C terms, you can express this: T *const x = ...; // Immutable pointer to mutable T.
But not this: T const *x = ...; // Mutable pointer to immutable T.
Even so, I don’t agree with the author’s argument that “const” is to be avoided. It does offer some protection against minor errors, which is not nothing. |
|