_counter
is the local variable within function counter()
. Every time when you call counter()
a new _counter
will be created.
But var createClosure = counter()
only called the function 1 time, that's why _counter
is not newly created every time and 'remembered' there (that's where closure happens)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…