View a function source code in firefox inspector

2019-09-06 06:51发布

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条回答
做个烂人
2楼-- · 2019-09-06 07:05

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

alert.toString() will output:

"function alert() {
    [native code]
}"
查看更多
登录 后发表回答