Home var, let, const
Post
Cancel

var, let, const

Var, Let, Const difference

Var
Duplicate declaration possible Scope: global, function
1
2
var first = 10;
var fitst = 20;
Let
Duplicate declaration NOT possible Scope: global, function
1
2
let second = 10;
let second = 20;   # error !
Const
Duplicate declaration NOT possible
Initialize at the time of declaration

Final

SectionVarLetConst
Re-declarationOXX
UpdateXOX
ScopeGlobalBlockBlock
This post is licensed under CC BY 4.0 by the author.