Say I have a function like this:
function wrap_function(fnInput)
{
if (somecondition)
{
return function() {
// Simplified example, in reality doing more stuff in here
fnInput.apply(this, arguments)
}
}
else
{
return fnInput;
}
}
I'm assuming that if somecondition is false this function won't create a closure and therefore won't have performance/memory impacts associated with closures.
Is this correct?