Agreed, defaulting to const is useful if because then when you see a let you know it must get reassigned.
More generally, sometimes variables are "values," and sometimes they're "places," and to me it's worth an extra two characters to be clear about which I'm using.
It's not about avoiding any sort of actual risk -- just about writing code that better expresses its intent.
Log in to continue
We're a place where coders share, stay up-to-date and grow their careers.
Agreed, defaulting to
const
is useful if because then when you see alet
you know it must get reassigned.More generally, sometimes variables are "values," and sometimes they're "places," and to me it's worth an extra two characters to be clear about which I'm using.
It's not about avoiding any sort of actual risk -- just about writing code that better expresses its intent.