Var
1. Variables declared with var go to the global scope.
2. We can redeclare a variable with the same name in the same scope.
3. We can update the value of the variable.
4. We can declare a variable without initialization.
5. Variables declared with var can be hoisted.
6. Variables declared inside a block will go to the global scope.
7. Variables declared inside a function will not go to the global scope. They will be accessible inside the function only.
Let
1. We cannot redeclare a variable with the same name in the same scope.
2. We can update the value of the variable.
3. We can declare a variable using let without initialization. But the JS Engine will keep that memory block uninitialized (empty) until it reads the declaration statement in the execution phase.
4. Because let variables are uninitialized (empty) in the variable phase, they belong to the Temporal Dead Zone (TDZ).
5. Variables declared using let do not belong to the global scope. We cannot access them with the help of the window variable.
6. Variables declared using let are hoisted and belong to the Temporal Dead Zone (TDZ). Therefore, they cannot be used before initialization (because at that moment, they are uninitialized - TDZ).
7. Variables declared inside a function will be accessible inside the function only.
Const
1. Variables declared with const are block-scoped.
2. We cannot redeclare a variable with the same name in the same scope.
3. The value of the variable cannot be modified.
4. We cannot declare const without initialization.
5. Variables declared using const are hoisted and belong to the Temporal Dead Zone (TDZ). Therefore, they cannot be used before initialization (because at that moment, they are uninitialized - TDZ).
6. Variables declared using const inside a block do not belong to the global scope. We cannot use them with the help of the window variable.
7. Variables declared inside a function will be accessible inside the function only.