3 ms·
While there's many legitimate and peculiar use cases where closures make sense when writing properly engineered code, my favorite use is simply abusing them in
by rl3 8y ago
While there's many legitimate and peculiar use cases where closures make sense when writing properly engineered code, my favorite use is simply abusing them in one-off or ad-hoc code where performance or correctness isn't a concern.
Basically just using them as lazy shortcuts to avoid the hassle of argument passing. It's particularly great when you have a function scope that's three or four levels deep, and you're referencing a variable via closure that's in the top-level function scope. Much less work.