Can be reassigned and are only available inside the function they're created in. Its function scoped.
var variableName = value;
It can be reassinged but its similar to const i.e. block scoped.
let variableName = value;
Cannot be reassigned and not accessible before they appear within the code. Its block scoped.
const variableName = value;
Keyword | scope | Redeclared (within the scope) |
---|---|---|
var | Global or Functional scope | Yes |
let | Block scope (inside {}) | No |
const | Block scope (inside {}) | No |
A block is a set of opening and closing curly brackets.