Reputation: 121
I have many external javascript files, now I have very difficult to find which .js file contain function definition of the given function name from inspect element console window.
I have tried the below
In the console window I have enter just the function name, the function definition is shown, but I can not find the function definition source .js file.
Upvotes: 2
Views: 2779
Reputation: 2030
use inspect(setcode)
.
From Devtools docu:
When passing a function to inspect, the function opens the document up in the Sources panel for you to inspect
Upvotes: 11
Reputation: 471
You can either use "grep" or find a good editor (VS Code or Atom).
About grep you can write
grep -Ril "[text to search for]" [path to search in]
in the linux command line [terminal].
And in Atom or VS Code you can search for it inside folder using ctrl+shift+f.
Upvotes: 1
Reputation: 752
The JS code gets loaded into the same namespace when they defined globally. Once loaded there is no way to tell from where the object has originated.
This is why you shouldn't pollute the global namespace. You should define objects/classes per file, at least while development/debugging.
Here is a good place to start to learn about OOP in JS
Upvotes: 0