Re:Airbnb JavaScript Style Guide
by epidemian on Friday July 03, 2015 @12:20AM
(#9823443)
In JS `const` just means that you can't reassign that variable, not that the value it references can't change:
[ Parent
| on HN ]
Re:Airbnb JavaScript Style Guide
by orthoganol on Friday July 03, 2015 @05:31AM
(#9824480)
The purpose of the code wasn't to illustrate how to use const.
It was to show how they want you to always use const with complex types.
Re:Airbnb JavaScript Style Guide
by anselmoars on Friday July 03, 2015 @05:43AM
(#9824519)
'const' is misleading, it doesn't set your variables as immutable.
Fine for expression, but not for actual practicality.
Re:Airbnb JavaScript Style Guide
by icebraining on Friday July 03, 2015 @06:20AM
(#9824626)
It does set your variables as immutable, just not your values. It makes sense if you see variables in these languages for what they are: references to values.