问题
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.
回答1:
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")
来源:https://stackoverflow.com/questions/35086894/view-parameters-passed-to-javascript-function-in-chrome