90

闭包-MD.杰克斯蒂娜的博客-51CTO博客

 6 years ago
source link: http://blog.51cto.com/12348050/2072525
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
闭包将组成函数的语句和这些语句的执行环境打包在一起时,得到的对象称为闭包说明如果一个内嵌函数访问外嵌函数作用域的变量,并返回这个函数,则这个函数就是闭包闭包的三个必须满足的条件必须有一个内嵌函数内嵌函数必须引用外部嵌套函数当中的变量外部函数返回值必须是内嵌函数示例得到一个数的N次方函数:defmake_power(y):deffn(x):returnx**yreturnfnpow2=make_po

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK