在javascript中调试闭包 [英] Debugging closures in javascript

查看:96
本文介绍了在javascript中调试闭包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试调试具有很多闭包的javascript代码,我用来放置断点。



然后我去看堆栈,但大多数



在javascript中调试闭包的最好方法是什么?

$ b在Google Chrome中,您可以在整个关闭中查看变量内容:





Local是当前执行上下文< br>
Closure是它的封闭执行上下文

...

到全局执行上下文


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

这篇关于在javascript中调试闭包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆