0

Is there a way to get the names of all the javascript function executed on a page?

something like

console.info(functionname)

As I am trying to fix some bugs on a customer's page and all javascript function are sepreaded all over the website withing PHP files.

user160820
  • 14,866
  • 22
  • 67
  • 94
  • http://stackoverflow.com/questions/1013239/can-i-get-the-name-of-the-currently-running-function-in-javascript – silly Mar 22 '12 at 09:24
  • Possible duplicate of [Can I get the name of the currently running function in JavaScript?](https://stackoverflow.com/questions/1013239/can-i-get-the-name-of-the-currently-running-function-in-javascript) – Michael Freidgeim May 11 '19 at 22:52

1 Answers1

0

The name of the current function can be obtained via arguments.callee.name. The name of any function is available in the name property of the funciton reference.

Use console.trace() to print the current stack trace. That does not only print the current function name, but also the previous ones.

If you want to get a string, containing the stack, have a look at How to get result of console.trace() as string in javascript with chrome or firefox?.

Community
  • 1
  • 1
Rob W
  • 341,306
  • 83
  • 791
  • 678