4 ms·
That seems to do it. let func = () => {}; console.log(func.name); // func and in stack traces: let func = () => foo(); func() results in: Uncaugh
by ehynds 11y ago
That seems to do it.
let func = () => {};
console.log(func.name); // func
and in stack traces:
let func = () => foo();
func()
results in:
Uncaught ReferenceError: foo is not defined
func @ test.js:1
- lewisl9029 11y agoWow. I had no idea that would work. All this time I've been using the full named function expressions over arrow functions just for the stack traces.
- ehynds 11y agoStill though, in situations where I care about the stack trace, I don't see myself writing: let doStuffCallback = () => {}; doStuff(doStuffCallback); over: doStuff(function doStuffCallback() { });