使用debugger在程序中加入断点

 使用debugger在程序中加入断点

我们可以在程序中加入debugger语句,这样Firefox的调试工具会停留在这条语句上,代码也暂停执行,和加入断点的效果一样。例如:

var myfunc = {
    get_field_value_callback : function() {
        debugger;
        var ed = this, target = ed.currSpan;
        /* do something more */
    }
}

然后在Firebug中查看效果。

也可使用专门的JS调试插件JavaScript Debugger,不过使用较为复杂。

原文地址:https://www.cnblogs.com/timssd/p/7789141.html