HTML Code:
var a = 10;
sayHi();
function sayHi()
{
var a = a + 10;
alert(a);
return a;
}
alert(a);
alert(sayHi()+10);
why the above result is not 20 and 30? i feel the first is 20 , then 30.in sayHi() function, there is a line var a; i don't know why the a is undefined。 thank you