JavaScript setTime() with Call back VS. with anonymous function
<p>I found the following two examples of setTime function, although the code looks the same, the result is different in the two cases.</p>

<p>Example1: Result "Hello Stack Overflow"      </p>

<pre><code>var a = "world";  
setTimeout(function(){alert("Hello " + a)}, 2000);  
a = "Stack Overflow";    
</code></pre>

<p>Example2:  Result "Hello world"</p>

<pre><code>function callback(a){  
    return function(){  
        alert("Hello " + a);  
    }  
}  
var a = "world";    
setTimeout(callback(a), 2000);    
a = "Stack Overflow";    
</code></pre>

<p>Why in the first example the value of a changed, and in excample2 it didn't?</p>
