While I was just playing around with JS, I wrote following snippet:
function checkArgs(abc,nbn,jqrs){
console.log("overloaded " +arguments.length);
}
function checkArgs(abc){
console.log(arguments.length);
}
checkArgs("aa","lll","pp");
I see output as " 3 " , however I was expecting out put as "overloaded 3". But I does not happen , however if I just swap the postions of those method, it does happen.
function checkArgs(abc){
console.log(arguments.length);
}
function checkArgs(abc,nbn,jqrs){
console.log("overloaded " +arguments.length);
}
checkArgs("aa","lll","pp");
Whats the rationale behind it?