|
Let
|
var
|
Origins
|
ES2015(ES6)
|
Pre ES2015
|
Scope
|
Globally scoped or blocke scoped
|
Globally scoped or function scoped. Attached to window object.
|
Global scope
|
Not attached to window object.
|
It is attached to window object.
|
Hoisting
|
Let is hoisted to top of its execution(either global or block) and unitialized
|
Var is hoisted to top of its execution(either global or block) and unitialized as undefined
|
Redclaraltion within scope
|
no
|
yes
|
Reassign within scope
|
yes
|
yes
|