闭包(Closure)这个概念如果没学过Swift的人应该也不会陌生. 学过Javascript的朋友应该知道,在Javascript中我们经常会讨论闭包,很多前端工程师的面试题也会问到什么是闭包. 那么,什么是闭包呢? 让我们看下在Javascript中闭包的解释: Closures are functions that have access to variables from another function’s scope. (This is often accomplished by…