DEV Community

Discussion on: JavaScript Var, Let, and Const

Collapse
 
bello profile image
Bello Osagie • Edited

Because when let is used to create a variable within a block scope ({ ... }), the variable is only available in it. This type of variables are called local variables; while when var is used to create a variable within a block scope ({ ... }), the variable is available everywhere in the program (within or outside the scope). This type of variables are called global variables