scope in JavaScript

Variables declared by var keyword are scoped to the immediate function body (hence the function scope) while let variables are scoped to the immediate enclosing block denoted by { } (hence the block scope).
```
(function run() {
  var foo = "Foo";
  let bar = "Bar";
  console.log(foo, bar); // Foo Bar
  {
    var foo = "Foo1"
    let bar = "Bar1";
    console.log(foo, bar); // Foo1 Bar1
  }
  console.log(foo, bar); // Foo1 Bar
})();
```