Is there a way to return the function that invoked the current function? Function.caller will only work for non-strict mode applications.
I want to be able to use this functionality for production environment, therefore I need strict mode to be turned on.
Expected return: function itself or the name of function.
function a() {
b()
}
function b() {
console.log(b.caller)
}
Function.caller will throw an error when used in strict mode:
Uncaught TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
error.stack
which is non-standard – Effloresce