say I have this
function isdef(x) { return typeof x !== 'undefined'; }
function banana(a, b, c) {
if (!isdef(a)) a = 1;
if (!isdef(b)) b = 2;
if (!isdef(c)) c = 3;
...
}
So all of the arguments are optional. If I want to call it with just c argument I'd have to write
banana(undefined, undefined, 5);
which is kinda clunky.
Sure I could do something like
window.k = undefined;
...
banana(k, k, 5);
But I'd really rather not make short window scope variables.
In vb.net for example, I could write
banana(,,5)
but js doesn't like that.
Is there a convenient way to do skip an argument in a function call?