This was what I came to comment on; when introducing ES6 features, this always trips people up. Thanks for "constant pointer to a list, not pointer to a constant list", I will use that next time I explain this.
This also means that objects defined with const can be mutated:
const x = { y: 2 };
x.y = 3;
Doesn't error. However with types that are immutable, like numbers and strings, const really is a constant: const HELLO = "hi" will never change.
This also means that objects defined with const can be mutated:
const x = { y: 2 }; x.y = 3;
Doesn't error. However with types that are immutable, like numbers and strings, const really is a constant: const HELLO = "hi" will never change.