Variables are containers for storing data values. In JavaScript, there are three ways to declare a variable:
var
- The var statement declares a function-scoped or globally-scoped variable, optionally initializing it to a value.let
- The let statement declares a block-scoped local variable, optionally initializing it to a value.const
- Constants are block-scoped, much like variables defined using the let statement. The value of a constant cannot change through re-assignment, and it can't be redeclared.