有关于匿名函数跟闭包的一道题

var demo=(function(a){

this.a=a;//从参数a=4
return function(){

this.a+=a;//this是指向window window=8

return a//这个闭包函数 是可以访问另一个函数的变量 也就是可以访问上一级的a也就是a=4,但是这个a不是指向顶级window 
}
}(function(a,b){
return a//这个是拿到4
}(4,8)))

demo(7)======>4

原文地址:https://www.cnblogs.com/lwwen/p/9212117.html