JAVASCRIPT VARIABLES
variables are containers for storing date.
JavaScript variables can be declared into four ways they are:
- Automatically
- var
- let
- const
NOTE:
- var keyword was used in all JS code from 1995 to 2015.
- let and const keyword were added to JS in 2015.
- var should only be used in old browsers.
WHERE TO USE var, let, const:
- Use const if the value should not be changed.
- Use let if you can't use const.
- use var if you must support old browsers.