在Firefox检查器中查看函数源代码 [英] View a function source code in firefox inspector

查看:131
本文介绍了在Firefox检查器中查看函数源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Chrome中,当您在控制台中键入一个函数时,会输出该函数的源代码。例如

 > $ .rails.confirm 
函数(消息){
return confirm(message);
}

但是在firefox inspector的控制台中,它只输出

  [object Function] 

如何在Firefox检查器中查看函数的源代码,例如在chrome中?

解决方案

只需在控制台function.toString() 。例如:

alert.toString()会输出:

 函数alert(){
[native code]
}


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?

解决方案

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

alert.toString() will output:

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

这篇关于在Firefox检查器中查看函数源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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