This seems to be a very common misconception that just won’t die. I keep running into it in blog posts, Twitter discussions, and even books. Here’s my attempt at setting things straight.
ES6 const does not indicate that a value is ‘constant’ or immutable. A const value can definitely change. The following is perfectly valid ES6 code that does not throw an exception:
const foo = {}; foo.bar = 42; console.log(foo.bar); // → 42
The only thing that’s immutable here is the binding. const assigns a value ({}) to a variable name (foo), and guarantees that no rebinding will happen. Using an assignment operator or a unary or postfix -- or ++ operator on a const variable throws a TypeError exception:
...
So, how to make a value immutable?
Primitive values, i.e. numbers, strings, booleans, symbols, null, or undefined, are always immutable.
...
const vs. let
The only difference between const and let is that const makes the contract that no rebinding will happen.
Everything I wrote here so far are facts. What follows is entirely subjective, but bear with me.












