Consider a scenario in which we have the following nested functions:
function function1(n) {
function function2() {
function function3() {
function function4() {
return n * 2;
}
return function4()
}
return function3()
}
return function2()
}
Firstly, I am curious if there is a way in JavaScript to determine if a function is being called inside function1 without accessing the actual code. Imagine I only know the name of function1 and it is located in a different JS file.
If the above question is not possible, then how can I check if a specific function (such as function2) is defined within function1 when I know the exact name? Is there a way to verify its presence without analyzing the entire content of function1?
As someone who is new to JavaScript, I appreciate your understanding and patience with my questions. Thank you!