Monday, 21 February 2022

Javascript Lessons: Let & Const

  • In ES6, the old way of declaring a variable (by using the keyword `var`) has been replaced by two new keywords i.e. `let` and `const`.
  • `let` is used when you want to declare a variable that may have variable values.
  • `const` is used when you want to declare a variable that will have a constant value that never changes.
  • `var` can still be used, but the use of `let` and `const` is highly encouraged.



Hafiz Hanif, PhD