object.prototype.x = 10; var w = 20;var y = 30; Console.log (x); (function foo () { var w = ten; var x = +; With ({z:50}) { console.log (w, x, Y, z);//+, ten, +, + console.log (this.x, THIS.W);//, cons Ole.log (WINDOW.W); 20}) ();
object.prototype.x = 10; var w = 20;var y = 30; Console.log (x); (function foo () { var w = ten; var x = +; With ({z:50}) { console.log (THIS.W, this.x, This.y, z);//+, ten, 100, console.log (x, W);//, 40 Console.log (WINDOW.W);//20}) ();
Search for __parent__ before searching for __proto__.
Closure function
object.prototype.x = 10; var w = 20;var y = 30; Console.log (x); (function foo () { var w = ten; var x = +; (function () { Console.log (w, x, y);//40,100,30}) ();}) ();
Because with will produce a temporary scope during run time, the closure function is within the scope of Foo.
Original: http://www.nowamagic.net/librarys/veda/detail/1645
Scope Chain Scope Chain