when I use global scope variable without 'var', its showing me Error. why?
<p>See my example code below</p>

<pre><code>&lt;script&gt;
alert(a); // undefined
alert(b); // It is Error, b is not defined.
var a=1;
b=10;
&lt;/script&gt;
</code></pre>

<p>When both variable a and b are in global scope, why I am getting error message for b. But there is no error message for variable a ? what is the reason ?</p>

<p>can anyone please explain me ?</p>
