About the scope in javascript,why the following not output 21 but 22?
<pre><code>function t()
{
    var x = 1;
    if(true)
    {
        var x = 2;
        alert(x);
    }
    alert(x);
}
t();
</code></pre>

<p>Anyone knows the reason?</p>
