Block Scoped let & const

Prior to ES6, var was the main way to declare variables. One of the things that made Javascript confusing was how it determines variable scope.

var in javaScript has function scope → variables live within functions & are scoped to the function. Any variable you create with the keyword VAR is local to the function that they were created in. A variable that was created in a parent function lives also in the child function.