Function caller object contains a reference to the function that called this function or null if the function was called from the global scope.
For example:
function outer(){ inner(); } function inner(){ console.log(inner.caller); } outer();
This code displays the source text of the outer() function.
Because outer() calls inner(), then inner.caller points back to outer().
For looser coupling, you can access the same information via arguments.callee.caller:
function outer(){ inner(); } function inner(){ console.log(arguments.callee.caller); } outer();
When function code executes in strict mode, attempting to access arguments.callee results in an error.
The calling to arguments.caller results in an error in strict mode and is always undefined outside of strict mode.
In strict mode, you cannot assign a value to the caller property of a function.