javascript 闭包内部机制
在初学JavaScript函数式编程的时候,经常会出现令人出乎意料的结果,而原因,大都是由于不理解JavaScript闭包引起的;理解JavaScript的闭包,可以从JavaScript的闭包内部机制出发。
函数:
function creatFunctions() {
var result = [];
for (var i = 0; i < 10; i++) {
result[i] = function () {
return i
};
}
return result;
};
console.log(creatFunctions())
结果:
0: function creatFunctions/result[i]()
1: function creatFunctions/result[i]()
2: function creatFunctions/result[i]()
3: function creatFunctions/result[i]()
4: function creatFunctions/result[i]()
5: function creatFunctions/result[i]()
6: function creatFunctions/result[i]()
7: function creatFunctions/result[i]()
8: function creatFunctions/result[i]()
9: function creatFunctions/result[i]()
这个函数会返回一组数组,应该每个函数都应该返回对应的值;而出现结果的原因就在于闭包不是立即执行的。
1、闭包的概念
JavaScript高设中,闭包是指有权访问另一个函数作用域的中的变量的函数,创建闭包的形式,就是在函数的内部创建另一个函数。
function makeFunc() {
var name = "Mozilla";
function displayName() {
alert(name);
}
return displayName;
} var myFunc = makeFunc();
myFunc();//MDN
displayName就是一个闭包。
2、闭包的内部机制
闭包的内部机制在于理解作用域链,函数的执行环境,变量对象和活动对象;
函数被调用时会创建一个执行环境,在执行环境中初始化该函数的活动对象、变量对象、和作用域链。其中,作用域链是指向当前执行环境可访问的变量对象的指针,是一个由内而外的过程。以上述函数为例;
由于所有函数的执行环境底层都是在全局执行环境中,JavaScript在运行时,首先初始化活动对象,即函数自带的arguments、this变量;全局变量makeFunc、myFunc会绑定到变量对象上;该执行环境初始化之后会推入栈中,此后会初始化函数makeFunc的局部变量,读取局部变量'name';内部函数displayName的函数声明;值得注意的是,每个执行环境的内部属性[[scope]] 保存当前执行环境可访问的变量对象,由内而外,即内部函数始终可以访问外部函数直到全局环境的所有变量,而外部环境是无法读取内部函数变量对象的;这是由于作用域链中定义的。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAkQAAAJBCAYAAACnLarpAAAACXBIWXMAAAsTAAALEwEAmpwYAAAgAElEQVR4nOzdeVyU5f7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eVL19er732mhYtWqTGjRvn+NqtW7eqXr16t91+XFycunbtant+6yewzE+OVapU0cWLF3Xp0iWVKFEiy6e0unXr2v3yTEtL08SJE5WRkaGZM2dKktzc3PJ0R/TBgwerZ8+eio6O1muvvaadO3dKkmrWrKkpU6ZIkiIiIjR8+HDt378/1xAnSW3bttU333yjkJAQXb9+XX379pUkpaSkaPHixZowYUKu2wDut7S0tCyjM9L/+l1Ooyn16tXTgQMHsvy/HTlypN3zrVu3SvpfgFi+fLmWL18us9lMP0eRQyAyuPPnz2vq1Kn69ddf9dFHH6l169aSpBEjRigjI0PDhw/XxIkT1b1792xfn9sntez87W9/sz2eOHGinJycNG7cOAUEBOS43e+//16lSpWSJN24cUMTJ07UiRMn9Mknn+jKlSsqV66cXFxc8rT/8uXLq3z58rZrImrWrJmlzRdffKFWrVpl+0vy0qVLttfGx8erXLlyevDBByVJDz30kF5//XW1bt1aNWvW1Jo1a3K8/gDIbzExMbftozmtCw8PV8eOHbVgwQIlJiaqR48etnWffvqpatSooa5du9oFGovFom3btunZZ59Vo0aN1L59e9s6+jmKAgKRQaWlpWnTpk36xz/+odq1a2vNmjWqW7euXZtRo0bJzc1N77//vr766iu9+eabevjhh+3arF69WnXq1Lntvv7880+98MILtueZw8lms1lr1qyxjTB169ZN586d05AhQ/T1119LunlBZr9+/eyGo0NCQvTjjz9q0aJFeuSRR9S/f395enraDWXfi4yMDO3bt09jx47Ndv2bb76pEydOSJJefvllmc1mnTp1yrb+xo0bGjBggKSbnxxdXFx08OBBSdKyZcv0+OOP35c6gbz664jKTz/9pLfeesvWzzL98ccfdiGldOnSmj17tho3bqz69esrJiZG/+///T/NnTs3yz5CQ0N15coVvfHGG5Lo5/TzoodAZED79+/XwoULdf78eXXp0kVDhw6Vk5OTzp07l6Vty5YtNWPGDC1ZskT9+vXTa6+9pqFDh97R/sqXL6+xY8cqNTVVpUuXtvul91dXr15V6dKlsywvUaKE7bGvr68ee+wxPf7441q7dq3i4uI0dOjQXC+mlKSSJ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dSpU7brjlxcXPTFF1/oo48+0ssvvywPDw+7/Tk5OalRo0ZaunSpYmNjc/xkd6vjx4+rdOnSKlmypPbu3avy5cvn+poyZcrk2iZTv379siw7deqU1q9fr3379mn27NkqU6aM7dstv/32m9zc3PTLL7/Yzd4LFAY///yzXFxcVKpUKX377bdZRolefvnlXLcxdepUvfPOO3bzjNHPUdQQiAyoQoUKdvOH3IkqVarIy8tLdevWzXEK/evXr2vGjBm2iyRdXFzk6emp1157TZL09ttv6/z583ryySdVrVo1bdmyRT169Mjx664jRozQu+++q169etlNnJaT+fPnKyIiQpJUtmzZLPdfup8SEhLk7++vCxcu6JlnntGGDRtsM34/8MAD6tixowYOHCir1SpPT081b94832oB7sYnn3yisLAwSTfnKMvsp5nyeg3RX4MU/RxFTe63Gi7EvLy8rFLOdyaGY6WmpspisahUqVJZrluwWCy2T5IpKSm5Xl+UnevXr+vnn39Wy5Yts6yzWCyyWq23vdD7fjl69KgeeeQRJmPLJ5mjlfTzO5d5c9fcbsBstVpltVqzfPV97969euqpp+zCTkpKir7//nt17NhRV65c0e7du9W/f/9st0s/R15l9vOjR486LJcQiAAUagQioPgrDIEo55tKAQAAGASBCAAAGB6BCAAAGB6BCAAAGB6BCAAAGB6BCAAAGB6BCAAAGB6BCAAAGB6BCAAAGF6xmKkaAAAUfcxUDQAA4EDF4m73jkyUAPJX5kgw/RwovgrDGR9GiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAAAgOERiAA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F1QAAwPAIRAAAwPAIRAAAwPAIRACAO3b27Fn16tWLiRtRbBCIAAB37PLlyzp79qyjywDuGwIRAOSTI0eOaODAgWrZsqW6d++usLAwSVJERITMZrN27Nihp59+WvPmzZMkJSYmauzYsfL29lb37t21YsUKmc1mpaam2l6TkpJi237mslvX79y5U507d1aXLl105MgRrVu3Tj4+PurUqZO+/fZb22tTU1P14YcfysfHR23bttW7775ru11H5rYOHz6sgQMHqlWrVurXr59Onjxpe72/v78kydvbW2az2bZ848aN6ty5s7y9vW3HlZM+ffro008/vbc3GbhPCEQAkE+uXr2qyZMn69ChQ+rQoYNmz55tt/7w4cPauXOnRowYIUkKCAjQlStXtHPnTq1YsUKHDh26432eOXNG27ZtU6tWrfTee+8pKipKu3btUocOHTR//nxbu1mzZunXX3/Vxo0bFRISokuXLikoKMhuW8HBwVq0aJG+/PJLVa9eXTNnzrStW7lypSQpLCxM4eHhkm7eZHbu3LmaNWuW9u/fL19f39vW+vzzz8vT0/OOjxHIDwQiAMgnPj4+cnd3V2RkpMqVK6eYmBilp6fb1g8ZMkRly5ZVuXLldOnSJX333XcaM2aMqlSpoqpVq+qVV1654332799frq6u6tq1qxISEuTv7y9XV1d16dJF586dU0ZGhi5duqTdu3dr4sSJcnNzU8WKFTVo0CDt37/fblujR49WlSpVVKFCBfn5+en06dOyWCw57tvZ2Vkmk0nnz5+Xq6urGjdufNtahwwZku1EkIAjMDEjAOSTxYsXa8eOHfLw8FCpUqUkyS5QPPTQQ7bH58+flyTVrVvXtqx8+fJ3vM+KFStKkm226szJGjP3n5GRofPnz8tqtWrAgAFZXp+WlmZ7XLlyZbtarFar0tPT5eLiku2+3dzcNHPmTC1cuFBr167VpEmTGAFCkUEgAoB8EB0drZUrV+qzzz6Tu7u7wsLCtHfvXrs2mfcLk27eX0ySLly4YHscFxdnW58ZQq5fv24LO5nX/NypzJu87tq1S9WrV7+rbeTE19dXHTt21KJFizR+/Hjt27fvvm4fyC+cMgOAfJB5aiw2NlZJSUnasG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mnTpk12baKjozV37lwtW7ZMTZo00e+//35XdQCORCACgEIoISFBsbGxWrJkicqUKSNJev31123rx48fL0l6+OGHNX/+fG3btk0dO3aUdHOkp2nTpra2ERERds//+9//2kaHcjNmzBjbtUoDBgzQ6NGjZbFY7No4OzvLZDLp/PnzatGihRo3bnwXRww4FoEIAAqhSpUqac6cOfL19dW1a9d07do1VapUye4O94sWLVLHjh0VEBCQbyGkatWqtsdly5aV1WpVenq6XRs3NzfNnDlTCxcu1Nq1azVp0iR5enrmSz1AfiEQAUAhtmfPHsXHx+vFF1/UtGnT1LJlS0lSZGSkxo4dq8GDB2d5TbVq1bR8+XLb827dumV5fr/5+vqqY8eOWrRokcaPH699+/bd930A+YlABACFXOXKlRUUFKR33nlHkyZNUlpamhYuXKiAgAC5u7tnaZ+QkKDhw4fbnsfHx9s9L1GihF37ChUqSJJ++uknPfroo7bneRUbG6u4uDg1adJEtWvXVmpqqqxWq0wm0x1tB3AkAhEAFAGPP/64hg4dqrfeeksmk0nvv/9+lm+EJScn6+2339Zjjz122225ublp+PDhtlGjunXrqnfv3hozZozKlSt3x6M7GRkZmjFjhmJiYlSrVi3NmjWLMIQip0j/j/Xy8rJK0tGjR4v0cQDIWX7388zth4eH58fm71rm/EMnT55UeHi4QkNDVaNGDfXr10+XL1/WunXr5OzsrObNm6tRo0aqWbOmli1blm0QOXnyZLYhqWvXrurbt29BHE6hkBkgC/pvBn+rclcY3iNGiACgEPrzzz81ZswYNWjQQC1atNDLL7+s6tWr29b369dPERER+uGHH/T111+rbNmyWrFiBSMzwF0iEAFAIZSXW2M0bdrU7uv0AO4eM1UDAADDIxABAADDIxABAADDIxABAADDIxABAADDIxABAADDIxABAADDIxABAADDIxABAADDIxABAADDIxABAADD415mAKD/3QkdgDExQgTA0KxW60FH14CCY7Vajzi6BhROjBABMLRjx475OLoGAI7HCBEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADA8AhEAADC8ko4uAAAcydPT87DJZGrh6DpQMKxW68Fjx475OLoOFD6MEAEwNMKQsZhMpg6OrgGFEyNEACApPDzc0SUgn5nNZkeXgEKMESIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAAGB4BCIAKGKSkpKyXX7hwoUCrgQoPghEAHCfREVFaezYsZJuhpMBAwbky366d++e7fKePXsqMjJSb7/9tv7880/b8sTERG3evFmSdObMGZ0+fdq27osvvtC///3vfKkTKEpKOroAACguvvrqK1WqVEmStG/fPj322GO3bZ+amipvb2+VK1fObnlycrLdsuTkZB05ckQlSpS47fZKlCihhx9+WB07dtSWLVv02muv2eo6deqUpJuhbfXq1Vq1apUkaefOnRo/fvydHShQDBGIAOA+sFqt2rlzp6ZNmyaLxaItW7bo0qVLCgsLy9K2U6dOevvttyVJTk5O+uabb2zrMjIy1KJFC7tlZrM52336+vraPb927Zqee+452/OyZctq8ODB2rx5s/78808dPnxYQUFBioqK0saNG/XPf/5TSUlJGjFihO0106dPV4sWLe7uTQCKMAIRANwHYWFhiomJ0ZNPPqldu3apcuXK+vzzz9W8eXP961//ypd97tmzx+55p06dtHXrVrm6utqW7dy5UyVKlNCBAwdkMpkkSf/4xz/00EMP6dFHH9WePXt07do1zZgxI19qBIoKriECgPtg+fLlkqQrV65o8eLFev311/P0OovFoqefftr206lTJ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ASUVORK5CYIIA" alt="" />
一般函数在执行完成后,会销毁其执行环境,只保留全局执行环境中变量;但是在闭包中,由于闭包并不是立即执行,而是保存着内部函数执行需要的所有变量,包括内部变量和外部变量;在需要时再执行;函数执行完毕后;由于内部匿名函数的作用于链依然引用这个活动对象;因此活动对象仍然会保存在内存中。
3、闭包的缺陷
闭包只是对函数内部的活动对象的保留,JavaScript中对变量只能保存一个定义;即 i 只能保存一个值,也就是上例中 i=10;闭包不是立即执行,当闭包执行时;向上搜索函数用到的所有变量,而内存中保存的是最后一次i的值;因此 i=10;
闭包会引用包含它函数的作用域,因此比普通函数占用更多的内存。
javascript 闭包内部机制的更多相关文章
- 一段代码说明javascript闭包执行机制
假设你能理解以下代码的执行结果,应该就算理解闭包的执行机制了. var name = "tom"; var myobj = { name: "jackson", ...
- JavaScript闭包的底层运行机制
转自:http://blog.leapoahead.com/2015/09/15/js-closure/ 我研究JavaScript闭包(closure)已经有一段时间了.我之前只是学会了如何使用它们 ...
- Python_Mix*函数名的使用以及第一类对象,闭包,迭代器,for循环的内部机制
一:函数名的应用(第一类对象) 函数名的命名规范和变量是一样的,函数名其实就是变量名, 0)函数名可以赋值给其他变量 def func(): #定义一个名为func的函数 print('my ange ...
- javascript 闭包(转)
一.变量的作用域 要理解闭包,首先必须理解Javascript特殊的变量作用域. 变量的作用域无非就是两种:全局变量和局部变量. Javascript语言的特殊之处,就在于函数内部可以直接读取全局变量 ...
- JavaScript 闭包整合
初遇闭包感觉很困惑,上网查看了些许介绍,有很多没看懂,就想先对能懂的东西整整 首先觉得要了解闭包,要先对一.JavaScript的变量作用域和作用域链有基本了解 1.变量的作用域分为:全局变量和局部变 ...
- 深入理解JavaScript闭包(closure)
最近在网上查阅了不少javascript闭包(closure)相关的资料,写的大多是非常的学术和专业.对于初学者来说别说理解闭包了,就连文字叙述都很难看懂.撰写此文的目的就是用最通俗的文字揭开Java ...
- 对于 Javascript 闭包理解
一.变量的作用域 要理解闭包,首先必须理解Javascript特殊的变量作用域. 变量的作用域无非就是两种:全局变量和局部变量. Javascript语言的特殊之处,就在于函数内部可以直接读取全局变量 ...
- javascript闭包的理解
闭包是Javascript的一个难点,但也是一个很重要的知识点. 1.首先我们要知道变量作用域链 变量的作用域分两种:全局变量和局部变量.没有定义到任何函数中的变量为全局变量,在函数中定义的变量为局部 ...
- 深入理解javascript闭包(一)
闭包(closure)是Javascript语言的一个难点.也是它的特色,非常多高级应用都要依靠闭包实现. 一.什么是闭包? 官方"的解释是:闭包是一个拥有很多变量和绑定了这些变量的环境的表 ...
随机推荐
- C# webApi上传图片 代码篇
十年河东,十年河西,莫欺少年穷 学无止境,精益求精 代码篇,不多说 如下: using System; using System.Collections.Generic; using System.D ...
- 11.11 开课二个月零七天(ajax和bootstrp做弹窗)
1.用ajax做弹窗显示信息详情 nation.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN&qu ...
- 以太坊remix-ide本地环境搭建
remix-ide简介 remix-ide是一款以太坊官方solisity语言的在线IDE,可用于智能合约的编写.测试与部署,不过某些时候可能是在离线环境下工作或者受限于网速原因,使用在线remi ...
- 牛客第二场-J-farm-二维树状数组
二维树状数组真的还挺神奇的,更新也很神奇,比如我要更新一个区域内的和,我们的更新操作是这样的 add(x1,y1,z); add(x2+1,y2+1,z); add(x1,y2+1,-z); add( ...
- Pair_Work Project
结对项目小记 ——by 12061227 康 12061179 宇帆 结对编程就是一种敏捷软件开发的方法,两个人在一个计算机上共同工作.一个人输入,而另一个人检查他输入的每一行代码.输入代 ...
- 软件工程——移动的HelloWorld
package disiti; import java.awt.Color; import java.awt.Cursor; import java.awt.Font; imp ...
- 广商博客冲刺第三天new
第二天沖刺傳送門 第三四天沖刺傳送門 这一天我们主要是弄网页前台设计跟框架设计,这方面主要是由张奇聪负责.我们在amaze ui,smart ui,angularjs+bootstrap中挑选,最终选 ...
- node基础 npm、module、exports、require
module 模块.包:可以认为是一个代码包,package,提供特定的功能(暴露给外界接口,让外界调用) exports 输出.导出:导出模块中的各种类型的变量,以及各种方法,导出之后,才可以被外界 ...
- shell脚本--逻辑判断与字符串比较
涉及到比较和判断的时候,要注意 整数比较使用-lt,-gt,ge等比较运算符,详情参考:整数比较 文件测试使用 -d, -f, -x等运算发,详情参考:文件测试 逻辑判断使用 && ...
- 利用ss-redir加速服务器上国外服务的访问
https://blog.microdog.me/2016/06/28/Speed-Up-Network-Accessing-To-Overseas-Services-On-Your-Server/