查看在Chrome中传递给JavaScript函数的参数 [英] view parameters passed to JavaScript function in Chrome
问题描述
我在Chrome开发人员工具中使用时间线来帮助编写用户脚本。时间线显示哪些函数被调用,但不是实际传递给参数的值:
有没有办法查看运行的实际功能,包括其值?我正在寻找任何解决方案,可以帮助我做到这一点,甚至在Chrome之外。
打开 Sources
选项卡在 DevTools
,选择左边的 Snippets
选项卡,右键单击并选择新建
,在中间窗口放置函数文本,从定义函数返回 arguments
,在中间窗口选择函数文本,右键单击并选择添加到监视
。在> Watch Expressions
右边的窗口中,应该在左边列出所选择的命名函数,然后是如何调用函数,例如 fn(abc,def )
后跟:参数[n]
指示并列出参数
传递给函数where n
是参数的数量
传递;例如参数[2]
用于 fn(abc,def)
I'm using Timeline in Chrome Developer Tools to help write a userscript. The timeline shows which functions are called, but not what values are actually passed to the parameters:
Is there a way to view the actual function that was run, including its values? I'm looking for any solution that will help me do this, even outside of Chrome.
Open Sources
tab at DevTools
, select Snippets
tab at left, right-click and select New
, place text of function in middle window, return arguments
from defined function, select text of function in middle window, right-click and select Add to Watch
. At right window at Watch Expressions
selected named function should be listed on left followed by how function is called, e.g., fn("abc", "def")
followed by : Arguments[n]
indicating and listing arguments
passed to function where n
is number of arguments
passed; e.g., Arguments[2]
for fn("abc", "def")
这篇关于查看在Chrome中传递给JavaScript函数的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!