Let's say I have a function myfunc
that can take up to two parameters: arg1
and arg2
:
var myfunc = function (arg1,arg2) {
console.log(arg1,arg2);
};
I want to call the function using only arg2
. However, when I run this, the input is passed to the first argument, and myfunc
will log "input" undefined
rather than undefined "input"
as expected.
myfunc(arg2 = 'input')
> "input" undefined
Does Javascript support this type of input?