steamer25:Could you please enlighten us by illustrating a scenario where a function like
function foo(a) { return true; }
must be used but
function foo2() { return true; }
...would not work?
There is no scenario. The nature of javascript basically states that those two functions are identical, since the method body here doesn't check the arguments. That said, this was probably used as a function pointer somewhere, and the argument is there just for housekeeping.
function fn1(a) { return a == 'zebra'; }
function fn2(a) { return true; }
function doStuff(fn, a) { fn(a); } where fn is fn1 or fn2
You could make fn2() instead of fn2(a) but this will just be easier for maintainance.