I have a JavaScript file with many methods defined in it. Is there any way to know how many methods are in that file & what are the names of methods?
While, in theory, you could try to find everything that matched the pattern:
function (
You'd be missing out on a lot of other types of functions. See, Functions are really just objects in JavaScript. They can be assigned, shared, modified, and moved around. So, you'd also have to find these:
var = function() {}
And these:
function returnFunc() {
return function() {...}
}
var = returnFunc();
As well as these:
obj.member = new Function();
And a nearly infinite variety of similar function definitions.
So, the answer is, most likely you can't. Unless the code is extremely narrowly constructed.