javascript interactive debugging (equivalent of python's pdb.set
I'm working with some javascript code and I'd love to be able to get an interactive console running in the context of a function call - that is, basically exactly what python's import pdb; pdb.set_trace()
import pdb; pdb.set_trace()
accomplishes. Is there any way to do this? If not, what's the best approximation out there?
I'm currently using Chrome's console to mess around with things, and I'd basically love to be dropped into the middle of a function call and use Chrome's console to poke around the local variables and such.
Set a breakpoint, and Chrome's Inspector will allow you to inspect your app's state.
Click the line number. A blue marker will appear. Execution will pause when you hit that line.
Write a debugger
statement in your code. The Inspector will pause when you hit the statement.
function something() {
// do stuff
debugger;
}
您可以在Chrome开发人员工具中设置断点,也可以在ie 8及更高版本中设置firefox和开发人员工具中的萤火虫。
链接地址: http://www.djcxy.com/p/63076.html上一篇: 评估字符串内的数学表达式