View a function source code in firefox inspector

爷,独闯天下 提交于 2019-12-14 03:15:37

问题


In chrome, when you type a function in the console, the source code for that function is outputted. For example

>    $.rails.confirm
     function (message) {
        return confirm(message);
      }

But in firefox inspector's console, it just outputs

[object Function]

How do I see a function's source code in Firefox inspector, like in chrome?


回答1:


Just write in console function.toString(). Example:

alert.toString() will output:

"function alert() {
    [native code]
}"


来源:https://stackoverflow.com/questions/23129449/view-a-function-source-code-in-firefox-inspector

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!