title: Why do I get 'undefined' when using let keyword in comparison to var
body: <p>I am trying to understand both <strong>let</strong> and <strong>var</strong> keywords. It is not clear for me why do I get <strong>'undefined'</strong> when I use let keyword?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let currentScope = 'global';
  function print() {
      let currentScope = 'local';
      console.log(this.currentScope); //undefined
      console.log(currentScope);     //local
  }
  
  print();
  console.log(currentScope);  //global</code></pre>
  </div>
  </div>
  </p>
  <p><strong>and here I use var</strong></p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var currentScope = 'global';
  function print() {
      var currentScope = 'local';
      console.log(this.currentScope); //global
      console.log(currentScope); //local
  }
  
  print();
  console.log(currentScope); //global</code></pre>
  </div>
  </div>
  </p>