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.
Brian Rinaldi is a Developer Experience Engineer at LaunchDarkly with over 20 years experience as a developer for the web. Brian is active in the community running CFE.dev and Orlando Devs.
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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In practice, I do what Wes Bos had recommended in his ES6 course: use
const
for every single variable, and only change tolet
if I will need to change that variable's assignment.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.