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.
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
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.
It's best to not use
var
since it's not block scoped. Uselet
when the variable has the potential to have it's value reassigned. Useconst
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
andconst
and how blockscoping works.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