123-Essential-JavaScript-Interview-Questions icon indicating copy to clipboard operation
123-Essential-JavaScript-Interview-Questions copied to clipboard

Question 4 - the definition of a closure is incorrect

Open vibecode opened this issue 4 years ago • 1 comments

I believe the definition of a closure as "a function defined inside another function..." is not particularly correct. A closure is a function + lexical environment it's bound to. It doesn't necessary require an outer function.

See also https://stackoverflow.com/questions/50529400/is-the-definition-of-javascript-closures-on-mdn-wrong

vibecode avatar Feb 17 '20 14:02 vibecode

You're right, I like Kyle Simpson definition much more after I read his books. May I ask you to create a pullrequest?

ganqqwerty avatar Feb 19 '20 10:02 ganqqwerty