'view parameters passed to JavaScript function in Chrome

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:

enter image description here

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.



Solution 1:[1]

Chromium does not list function arguments with the other function parameters, or in any of the closure sections.

The arguments passed to a function are placed into a local property called arguments. This property is an array.

There are 2 ways to view them at a breakpoint.

In The Console

Open the console, and type arguments. Then press enter.

enter image description here

In The Watch Panel

Open the watch panel in the debugger, and enter arguments as a watch item.

enter image description here

Solution 2:[2]

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")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 guest271314