John Abraham
John Abraham

Reputation: 18821

Why is the invocation of a named function considered anonymous in chrome dev tools?

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)?

enter image description here

enter image description here

Upvotes: 1

Views: 112

Answers (1)

Kaiido
Kaiido

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

Related Questions