title: Javascript:why the result of the function about alert is undefined
body: <pre><code>var name="Jim";
  var func=function(){
     alert(name);
     var name=true;
  }
  func();
  
  var name="Jim";
  var func=function(){
      alert(name);
      name=true;
  }
  func();
  </code></pre>
  
  <p>Two function has different results, can someone give me an explaination?</p>