http://jibbering.com/faq/notes/closures/
原文较多,这里摘一些比较重要的来说明问题。
The simple explanation of a Closure is that ECMAScript allows inner functions; function definitions and function expressions that are inside the function bodes of other functions.
最简单的定义:一个内部函数(这个就不用再解释了吧。。),感觉和java的内部类有点相似。。
所以
those inner functions are allowed access to all of the local variables, parameters and declared inner functions within their outer function(s).
内部函数可以访问外部所有的变量、其他内部函数等所有东西。。
只是这样还不够,还要再满足一个条件才能形成闭包。
A closure is formed when one of those inner functions is made accessible outside of the function in which it was contained
即当这个内部函数在包含它的外部函数之外被调用时,就形成了闭包。