title: Redefining a local variable with var in JavaScript
body: <p>I have a rather general question regarding JavaScript and local variables. My question is what is the difference between the following and if there is any:</p>
  
  <pre><code>function bla
  {
      var a = 2;   // local variable
      a = 3;       // the local variable a gets a new value
  
      // Would do the following line anything different 
      // (than simply asigning this value?)
      var a = 4;
  }
  </code></pre>
  
  <p>I suppose I won't get two local variables named a. In other languages this is even an error. So is there any use for this?</p>