At some point in the past, I read something that gave me the idea that anonymous functions in JavaScript can use up a surprising amount of memory (because they carry the entire current scope around with them), whereas named (static?) functions don’t have this issue.
I can’t remember where I read this, so I can’t go back and re-read it and figure this out for myself.
I’ve got two questions:
- Are there situations where anonymous functions can use enough memory for it to be worth caring about? (If so, do you have an example?)
- Are there any other drawbacks to anonymous functions (as opposed to named/static functions)?