Anonymous function expressions in JS bug me as they make stack traces and Chrome Dev Tools profiler output harder to use, so I've decided to name ALL my function expressions from here on in. The obvious thing seems to be to name them the same as the name I am assigning them to, e.g.this.myFunc = function myFunc() {};If I understand correctly, this means the second myFunc is the one that is bound within the function body, leaving it unable to easily access the first myFunc from the outer scope but...I can't see how this is of consequence as I can't imagine a scenario where I would ever need to refer to the outer myFunc anyway. That said, myForesight !== theFuture and Javascript is a strange and dangerously liberal language, so... if this strikes any of you as anti-pattern, please speak up now! Thanks.
Are there any scenarios where a JS function expressions would need to refer to its name?
javascript;coding style;naming