

ES6 `const` not always immutable - jacopotarantino
https://jack.ofspades.com/es6-const-not-immutable/

======
iamdanfox
This is familiar to programmers who are used to pointers or references.
(Java's `final` does the same thing).

To prevent changes to an object's properties, you could use `Object.freeze()`
instead [1]. NB, this is shallow, so a child object of a frozen object can
still have its properties changed.

[1]: [https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Refe...](https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze)

~~~
jacopotarantino
Thanks for the feedback! I did know about the pointer bit but for people
unfamiliar this might come as a bit of a shock. I'm going to update the post.
Hit me up on twitter if you'd like to be credited(@jacopotarantino) since I
don't check in here very often.

------
tantalor
That is exactly what I would expect.

~~~
Bahamut
Agreed - in fact, when writing services for Angular in ES6, I take advantage
of the fact that I can define a function using const and then set the $inject
propert of it.

