title: How does JS variable override work?
body: <p>This code works fine:</p>
  
  <pre><code>const a = 1;
  {
    const b = a; // let's use "a" in a sub-scope
  }
  {
    const a = 2; // let's override "a" in another sub-scope
  }
  </code></pre>
  
  <p>... but this code fails with <code>a is not defined</code> at line 3:</p>
  
  <pre><code>const a = 1;
  {
    const b = a; // let's use "a" in a sub-scope &lt;&lt;&lt; CRASH!! &gt;&gt;&gt;
    const a = 2; // let's override "a" in the same sub-scope
  }
  </code></pre>
  
  <p>I tested this on <code>node 7.7.4</code>. It may be related to V8 only, I'm curious how Firefox would handle this.</p>
  
  <p>Is it related to the way variable declaration is defined in the JS spec? <code>const/let</code> are not hoisted, but "something" (some metadata?) still seems to be hoisted, else we would have no issues.</p>