Changing a Variable Out of Scope?

Posted by Matrym on Stack Overflow See other posts from Stack Overflow or by Matrym
Published on 2010-05-04T02:49:26Z Indexed on 2010/05/04 2:58 UTC
Read the original article Hit count: 301

Is there any way to change a variable while out of scope? I know in general, you cannot, but I'm wondering if there are any tricks or overrides. For example, is there any way to make the following work:

function blah(){
 var a = 1
}
a = 2;
alert(blah());

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about scope