Is there a way in real-time to see the number of function calls that are in the stack before or regardless of whether the stack size might be exceeded? Could it be shown like this:
console.log("Function: " + funcName + ", nbr of calls in the stack: " + funcCount);
// Function: foo, 22
// Function: bar, 300
// etc...
Functions are called like this:
var mod = function () {
var obj = {
foo: (fn) => "My name is: " + fn,
bar: (fn) => "My name is: " + fn
};
console.log(((fn) => obj[fn](fn))("foo"));
console.log(((fn) => obj[fn](fn))("bar"));
};
mod();
// My name is: foo
// My name is: bar
So the function when running knows its name since it's passed in.