DEV Community

Discussion on: JavaScript's const keyword

Collapse
 
askharley profile image
Harley Ferguson • Edited

It's best to not use var since it's not block scoped. Use let when the variable has the potential to have it's value reassigned. Use const in scenarios where the variable's value isn't going to change or you don't want it to change.

I wrote this article outlining some of the major changes introduced with ES6. Might provide more context on how to use let and const and how blockscoping works.

Collapse
 
abodmicheal profile image
Abod Micheal (he/him)

yea I understand that , have not actually seen the use of const that's why I just ignore , I use var and let alot and I understand them , but thanks I understand