We excluded some of this misunderstanding and to understand
, it depends entirely on the function of this position call each function is invoked when bound
. Looking call position is looking for "location function is called," but doing it is not so simple, because some of the programming mode may hide the real location of the call
The most important thing is to analyze the call stack, it is to reach all functions called by the current execution position
function baz () { // call position is a global scope, the call stack baz the console.log ( 'baz' ); bar (); // bar call sites } function bar () { // call baz position in the call stack baz -> bar the console.log ( 'bar' ); foo (); // foo call sites } function foo () { // call site bar in the call stack baz -> bar -> foo the console.log ( 'foo' ); } baz (); // baz call sites
The call stack can be thought of as a chain of function calls, but this method is very cumbersome and error-prone. Another approach is to view the call stack using the browser debugging tools. Sources inside the Call Stack; use development tools to get the call stack, the stack and then find the second element, is the real calling location.