Is anonymous function re-written Fooin memory every time it is called Foo()?
function Foo(product)
{
return function(n) {
return n * product;
}
}
I am more or less interested in implementing V8, in particular, because I do not see anything in this regard in the specification (unless I miss something that I probably have).
I am a bit confused about memory management as usage productrefers to a closure that returns; however, this does not necessarily mean that the inner function must be recreated with the closure instance (theoretically), since you can still .bind()without losing the closure value.
source
share