title: what is differences between var a = b = 2 and var a = 2; var b=2;
body: <p>when i declare variable in a function, i face a problem. </p>
  
  <pre><code>var b = 44;
  function test(){
      var a = b = 2;
  }
  </code></pre>
  
  <p>But this works fine: </p>
  
  <pre><code> var b = 44;
   function test(){
      var a;
      var b = 2;
   }
  </code></pre>
  
  <p>Variable b over rides the global b variable.</p>
  
  <p>I cannot find any documentation about this behavior. </p>
  
  <p>Is there any documentation about it ?</p>
  
  <p>demo : <a href="http://jsfiddle.net/uq4nxk1k/1/" rel="nofollow noreferrer">http://jsfiddle.net/uq4nxk1k/1/</a></p>