对于以下脚本,我如何编写一个将脚本的所有函数作为数组返回的函数?我想返回脚本中定义的函数数组,以便我可以打印脚本中定义的每个函数的摘要。
function getAllFunctions(){ //this is the function I'm trying to write
//return all the functions that are defined in the script where this
//function is defined.
//In this case, it would return this array of functions [foo, bar, baz,
//getAllFunctions], since these are the functions that are defined in this
//script.
}
function foo(){
//method body goes here
}
function bar(){
//method body goes here
}
function baz(){
//method body goes here
}