0
how to define same name fnction multiple time
I want to define function with same name multiple time so what should i have to do?
6 Answers
+ 1
Check out this sample:
var disp = function() {
alert("Sunny, temparature is 20 degrees.");
}
disp(); // alert temperature msg
disp = function() {
alert("Rain fall is 2 inches today.");
}
disp(); // alert rall fall info
https://code.sololearn.com/W6mODdmx2n88/?ref=app
+ 1
No we can make multiple functions with same name but different arguments. Like this
function a1(name){
//code
}
function a1(name,age){
//code
}
a1(âNarendraâ);
a1(âNarendraâ,25);
Like that we can achieve. I find it.
+ 1
What do you want actually?
+ 1
Overloading Function will help you
0
it will cause an error and it is not good programming practice
0
sorry, it does not, but it still is not good practice