var foo = function(){ var cnt = 0; return function(){ return cnt++; };};var closure = foo();console.log(closure());console.log(closure());console.log(closure()); 一个可调用对象引用一外部的变量(但又不是全局变量)时,就形成了闭包。 Read More
posted @ 2013-09-10 21:50 庚武 Views(167) Comments(0) Diggs(0) Edit