Hacker News new | ask | show | jobs
by derpydev 3185 days ago
You seem to be mixing up the concepts of "constant" and "immutable". In the context of JS, constant is a characteristic of the variable identifier and only suggests that it will never be reassigned to point to another value or reference in the current scope. The mutability of the referenced value is entirely up to the definition of said value's type (hence why stuff like Immutable.js exists).

The idea that JS programmers can't learn from others' languages first is an odd one considering that, if I remember correctly, const in JS has the same semantics as the final keyword in Java and it's the default semantics of any local variable in Rust, so it's not something that seems to be out of the ordinary or falling out of favor.