问题
How do i trace the values of local variables in closure, and also the execution flow of closures in firebug. or is there any other tools that is specifically for debugging closures.
回答1:
Yes. You can debug the javascript closure with Firebug. On Script tab, you can see all the object instances as well as the state of the whole object. Please, Find it below the screenshot of firebug showing local variables in closure.
(source: pengbos.com)
If you want to learn more read this here and practice it.
回答2:
In Google Chrome's Developer Tools you can inspect the closure stack by setting a breakpoint (in the Scope Variables section):
I would assume Firebug has similar functionality.
回答3:
You can see Closure Inspector of Firebug.
来源:https://stackoverflow.com/questions/8921291/how-to-trace-or-debug-javascript-closures-in-firebug