JavaScript inner function scope chain?
Posted
by Ding
on Stack Overflow
See other posts from Stack Overflow
or by Ding
Published on 2010-05-18T14:49:27Z
Indexed on
2010/05/18
15:00 UTC
Read the original article
Hit count: 230
JavaScript
|scope
In this example
var a = 1;
( function(x) {
function inner() {
alert(a);
alert(x);
alert(y);
}
var y = 3;
inner();
})(2);
When does function inner get created? during execution time or parsing time of outer anonymous function?
What is in the scope chain of function inner?
What is in the execution context of function inner?
I know it is not a simple question, thanks for enlighting me in advance!
© Stack Overflow or respective owner