var vs let vs const
JavaScript has 3-different keywords to declare a variable.
Example : var, let, and const
Let’s see the difference between var vs let vs const:
| Keyword | Scope | Hoisting | Can Be Reassigned | Can Be Redeclared |
|---|---|---|---|---|
| var | Function scope | Yes | Yes | Yes |
| let | Block scope | No | Yes | No |
| const | Block scope | No | No | No |
JavaScript