My guess is that this is not possible, but I'd like f
and f()
to do the same thing.
var f = function(str){ console.log(str||'foo'); }();
f; // wanted output: 'foo'
f(); // wanted output: 'foo'
f('bar'); // wanted output: 'bar'
Because f
is no longer a function definition, it doesn't seem possible to do f()
, but maybe I'm missing something. Any suggestions?