In JavaScript, you can access parameter names without explicitly naming them. For example:
function hi(){
if( arguments[0]=="andy"){
return;
}
alert(arguments[0]);
}
You can use arguments[0] Access the first parameter, and so on.
Use the arguments object to implement overloading, and use arguments.length to get the number of parameters of the function, as follows:
function hi(){
if(arguments.length==1){
alert(arguments[0]);
}
else if(arguments.length==2){
alert(arguments[0] arguments[1]);
}
}