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

 

内容来源于网络如有侵权请私信删除
你还没有登录,请先登录注册
  • 还没有人评论,欢迎说说您的想法!