News for hackers. Stuff that matters.
Re:JavaScript variables: var and let and const by cryptica on Saturday March 07, 2020 @02:41AM (#22510386)
I use `let` mostly and I only use `const` for special cases when changing the variable would break the program and I want to constrain future developers from doing that. For example, when I import some library references in Node.js using `require`, I will use `const` or if I need to define a magic number like `const HANDSHAKE_TIMEOUT = ...`.

I don't see the point of using const everywhere though because I don't code in a pure functional style and I don't pretend to.

Often, it makes sense to re-assign a variable and I don't want to mislead future developers into thinking that it's not OK to do so if the requirements have changed.

There are no comments on this comment yet.