Let's say I've defined a function :
function myAwesomeFunction(x){
console.log(x);
}
now, what I expect is, if I'll call it like this: myAwesomeFunction(1)
or myAwesomeFunction('lol')
or myAwesomeFunction('whatever')
, it'll work and it does.
but how does it work, even when I pass extra arguments to the function and simply ignores all arguments except the first one :
myAwesomeFunction('why so', 'serious?')
we don't even have any optional arguments in the above function?(i.e, like (x, y='')
)
function myAwesomeFunction(x){
console.log(x);
}
myAwesomeFunction(1);
myAwesomeFunction('lol');
myAwesomeFunction('whatever');
myAwesomeFunction('why so', 'serious?')
myAwesomeFunction('why', 'so', 'serious?')