Possible Duplicate:
List of global user defined functions in JavaScript?
I have a java script file (.js) which contains some functions:
function func1(arg)
{
}
function func2(arg)
{
}
...
I want to enumerate all functions defined in js file. Is there a root object in javascript to enum all sub objects by it? (by methods defined in this post)
Ugly solutions:
One approach is to define an array like: var functions = [func1, func2, ...];
Another approach is string processing (such as regular expressions):
/function.+(.+)/
I there better solution for it? thanks.