Demystifying JavaScript Variable Scope and Hoisting

I can’t say I never use function declarations, but at this point my general strategy is to use named function expressions. It can feel a bit redundant, but I like that it allows me to have a clear list of the identifiers at play AND to avoid the ambiguity of anonymous functions in stack traces. Of course this also creates issues about which one must remain cognizant: JScript bugs etcetera

Personally, I’m not aware of any perfect solution at this point, although browsers are, on the whole, getting better at associating names with anonymous functions in traces. In any case, though, I’ve yet to run into a circumstance wherein I’m forced to deal with anything quite like the contrived example about which I first commented.

I’m happy to hear your thoughts on the topic if you have more, though.