const Fns = []
function foo() {
Fns.forEach( fn => {
fn()
})
}
function bar() {
function test() {
return 'test'
}
Fns.push(() => {
const value = test()
print(value)
})
function print(value) {
console.log(value)
}
foo()
}
bar()
请问在我push进这两个的时候,又在foo函数中调用,这个是否构成闭包?
当打印出 test的时候就是闭包了,const value = test()