Reputation: 18821
I have a function called doStuff function doStuff(prop){ console.log(prop) } I invoke the function like so: doStuff('boop');
Question: Why does chrome dev tools consider the doStuff('boop')
invocation line 4
an (anonymous function)
?
Upvotes: 1
Views: 112
Reputation: 137133
From https://developer.chrome.com/devtools/docs/javascript-debugging#call-stack-panel
The Call Stack panel displays the complete execution path that led to the point where code was paused
So the "(anonymous function)
" you get, refers to the caller of the function.
In your example, you are calling it from the "top" execution process, which occurs when the browsers have finished loading the scripts. Thus, there is no caller, the devTools then considers it as an anonymous function
call.
Upvotes: 2