Variables of java script

what is the different between
var
let
const

1 Like

1.Scope
VAR- Variables declared with var are in the function scope.
LET- Variables declared as let are in the block scope.
Const- Variables declared as const are in the block scope.

  1. Hoisting
    VAR- Allowed
    LET- Not allowed
    Const- Not allowed

  2. Reassign the value
    VAR- Allowed
    LET- Allowed
    Const- Not allowed

2 Likes