I've seen this a few times - in a top level function an old programmer at my job used to do the following:
function x() {
return new function() {
//some code
}
}
What is the difference between that and:
function x() {
return function() {
//some code
}
}
Wouldn't returning an anonymous function without new instantiate a new function every time? It's not currying, so I'm not sure I see a difference.
Thanks