DEV Community

Discussion on: Once and for all: const in JavaScript is not immutable

Collapse
 
thebuzzsaw profile image
Kelly Brown

It's all a war of semantics. Technically, the variable itself is immutable for its lifetime; it just so happens to act as a gateway to data that is quite mutable. This is why I hate the way Java tries to teach students: "Everything is pass by value." Yeah, everything is pass by value... but the value happens to be a reference to something else. Strange that something passed by "value" lets me trigger side effects for observers of that data.

Good post.