var, let, const Differences
Understanding variable declarations in JavaScript

One of the features that came with ES6 is the addition of let and const, which can be used for variable declaration. The question is, what makes them different from good ol' var which we've been using.
One of the features that came with ES6 is the addition of let and const, which can be used for variable declaration. The question is, what makes them different from good ol' var which we've been using.
Key Differences
- var declarations are globally scoped or function scoped
- let and const are block scoped
- var can be updated and re-declared
- let can be updated but not re-declared
- const cannot be updated nor re-declared
💡 Tip: For more details, visit: https://www.freecodecamp.org/news/var-let-and-const-whats-the-difference/