How to detect the source (file) of a function through the developer console?

2

I do not know if this question fits the standards / scope of the OS, but here it goes:

Is it possible to detect the source (file) of a javascript function through the developer console in the current browser?

For example:

I have a javascript file with the function:

function teste(){
}

Entering console mode if you start typing te Note that there is a teste function, but right now I do not know where it comes from.

In my view, the only method I can determine is to check all requests made to the server by .js files and search for the teste() string in each of these files.

But if the site has multiple javascript files, it is difficult to determine the correct file, not to mention if the script is not obfuscated, which will further complicate things.

What brings me to the question:

Is there a more viable method for me to do this function's source detection?

For example if this function were a event listener of a click on a button I could easily detect its source inspected the button element.

    
asked by anonymous 21.02.2018 / 12:57

1 answer

1

In chrome , you have the option to go to the function definition in the console itself.

InfirefoxIcouldnotfindawaytogotothefunctiondeclarationthroughtheconsole,howeverwecanlookforthenameofthefunctioninallthefiles.

    
21.02.2018 / 13:47