How to Use JavaScript variables?
JavaScript provides two different ways of explicitly defining new variables and one way of defining constants.
- const: For constant block scoped values that cannot be changed later on.
- let: For block scoped variables where we want to be able to change the value.
- var: For global/function scoped variables that can be changed and redeclared. (should not be used in modern JavaScript code)