News for hackers. Stuff that matters.
Re:Common JavaScript Gotchas by jblotus on Sunday January 13, 2013 @08:50AM (#5050737)
well, functions close over scope no matter what you call them.
Re:Common JavaScript Gotchas by catshirt on Sunday January 13, 2013 @03:26PM (#5051750)
not exactly. closures close over scope. functions alone simply create a new scope. these concepts are not synonymous.

if your function doesn't return another function, the references from that function are deallocated once the function has executed.

when your function returns a function (a "closure"), the inner function closes over the variables of the outer function, maintaining references to it's context as long as you maintain a reference to the closure.

Re:Common JavaScript Gotchas by jblotus on Tuesday January 15, 2013 @09:30AM (#5060218)
ok i see your point. i conflated the terms function and closure in this case.