19 ms·
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
by ksikka 11y ago
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- Touche 11y agoconst a = {b: "foo"}; a.b = "bar";
- dangoor 11y agoconst a = icepick.freeze({b: "foo"}); Granted, that's not as elegant as built-in support but that is literally what I'm doing at the moment when I want immutability.
- Touche 11y agoSo if you go to extraordinary lengths you can use JavaScript functionally but it's not very functional by default aside from the first-class functions. Personally I just embrace it's imperative/functional blended nature and go with it.
- deleted 11y ago[deleted]
- pyrophane 11y agoYea, const provides immutability with respect to assignment, but without immutable objects and collections, it isn't going to get you all the way.