what's difference of these code? And why?
<p>I think it will be same,but it not. please tell me why?
thanks. </p>

<pre><code>var a,b;
function setA(x){
    a = x;
}

function setB(x){
  var a = 'a2';
  setA(x);
  b = x;
  alert(a);  //
}
setB('b')
</code></pre>

<hr>

<pre><code>var a,b;  
function setB(x){
  function setA(x){
      a = x;
  }
  var a = 'a2';
  setA(x);
  b = x;
  alert(a);  //
}
setB('b')
</code></pre>

<p>I think it will be same,but it not. please tell me why?
thanks. </p>
