DEV Community

Discussion on: Confused by JavaScript's const? Me too!

Collapse
 
jwkicklighter profile image
Jordan Kicklighter

In practice, I do what Wes Bos had recommended in his ES6 course: use const for every single variable, and only change to let if I will need to change that variable's assignment.

Collapse
 
remotesynth profile image
Brian Rinaldi

Thanks for the comment. I had received similar recommendations. A team that I worked with even had ESLint set to enforce using const for every variable where it wasn't reassigned - even objects that were mutated. This is where it caused me confusion and it was probably more common than actual primitive constants in the code. As a personal style preference, I would not choose to do that where I have the option.