Just need to add that internally closures maintain a seperate memory allocation of its lexical environment that is why when closure returned function is returned.
it looks to allocated memory for lookup process to find variable that was enclosed at the time of closure. I hope my understanding is correct ;)
Yes, exactly. Well explained. :) The inner function has there own lexical or static scope, and in the lookup process it looks first in the "own" memory.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Excellent explanation.
Just need to add that internally closures maintain a seperate memory allocation of its lexical environment that is why when closure returned function is returned.
it looks to allocated memory for lookup process to find variable that was enclosed at the time of closure. I hope my understanding is correct ;)
Yes, exactly. Well explained. :) The inner function has there own lexical or static scope, and in the lookup process it looks first in the "own" memory.