Demystifying JavaScript Closures, Callbacks and IIFEs

But the point is that the returned value was created inside the lexical scope of another function and would normally be inaccessible outside of that function.

I admit that the example is basic and in most cases a function would be returned to form a closure, but I don’t think that’s necessary for it to actually be a closure.

All this discussion certainly shows that they are a difficult concept to define!