When I try to debug the javascript code which has a lot of closures I use to put a breakpoints.
Then I go to see the stack but most of the times I just see a call stack full of anonymous functions which is a nightmare for me.
What is the best way to debug closure in javascript?
Well, in Google Chrome, you can see variables content throughout closures:
Local is the current execution context
Closure is its enclosing execution context
…
Up to the global execution context