JavaScript Const
- Constants are block level scope variables. The scope may either global or local scope.
- Constants are working like variables defined using let statement.
- We can’t modify value of constants.
- Constant re-declarations are not allowed.
Using const keyword in another example, a, b, and c, are variables is as follows:
If you want a general rule: always declare variables with const.
If you think the value of the variable can change, use let.
Example
Output