In JavaScript, is it possible to obtain a list of all functions that are called by another function? I want to create a tree of function dependencies, to analyze how the functions in a script are related to each other (and which functions are required by which other functions).
For example:
getAllCalledFunctions(funcA); //this should return [funcB, funcC, funcD], since these are the functions that are required by funcA.
function getAllCalledFunctions(functionName){
    //how should I implement this?
}
function funcA(){
    funcB();
    funcC();
}
function funcB(){
    funcD();
}
function funcC(){
    funcD();
}
function funcD(){
    console.log("This function is called by funcC and funcD");
}
 
     
     
     
     
    