JavaScript by Patrik

Definition of const

The const keyword was introduced in ES6 (2015).

  • Variables defined with const cannot be Redeclared.
  • Variables defined with const cannot be Reassigned.
  • Variables defined with const have Block Scope.

When to use JavaScript const? As a general rule, always declare a variable with const unless you know that the value will change.

Comments