I executed it three times:

First time I executed it as it is and I didn't get any alert because
variable x is not accessible outside function .
Second time I removed the operator var and  executed it . I got  alert
as expected(value of x).
Third time when I execute it with the operator var and I get alert
with the value of x.This is something strange .Please tell me why it
is happening.




function number()
{
var x=2;
}

number();

alert(x)

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Firebug" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
https://groups.google.com/forum/#!forum/firebug

--- 
You received this message because you are subscribed to the Google Groups 
"Firebug" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to