Quantcast
Channel: Node.js Tools for Visual Studio
Viewing all articles
Browse latest Browse all 4630

Edited Issue: Anonymous functions get assigned the name of the next assigned variable in Call Stack [432]

$
0
0
Consider this code:
```
function f(g) {
g();
}

f(function () {
return;
});

h = 123;
```
Put a breakpoint at return. When it's hit, the current function is reported as "h" in the call stack, even though it's an anonymous function that has no relation to variable h.

In general, it seems to be the case that an anon function gets assigned the name of the first variable that is assigned anywhere after the function-expression is evaluated.

Viewing all articles
Browse latest Browse all 4630

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>