title: Redeclaration in function body with let and var
body: <pre><code>function func(arg = 1) {
      var arg = 2; // success
      // let arg = 2; // SyntaxError: Identifier 'arg' has already been declared
  }
  </code></pre>
  
  <p>I followed ECMA spec-7.0 <a href="http://www.ecma-international.org/ecma-262/7.0/#sec-functiondeclarationinstantiation" rel="nofollow noreferrer">FunctionDeclarationInstantiation</a> algorithm to see why exactly you can use <code>var</code> to redeclare a variable in the function body.</p>
  
  <p>In step 21, all the parameters have been initialized. But the algorithm both use <strong>CreateMutableBinding</strong> to initialize variables declared in the body for <code>var</code>(27.f.i.2) and <code>let</code>(34.b.ii.1), so why does <code>var</code> succeed and <code>let</code> fail? What steps have I miss in the algorithm?</p>