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?

1st Oct 2017, 1:26 PM
Naren
Naren - avatar
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
1st Oct 2017, 1:36 PM
CalviŐ˛
CalviŐ˛ - avatar
+ 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.
1st Oct 2017, 1:46 PM
Naren
Naren - avatar
+ 1
What do you want actually?
1st Oct 2017, 1:48 PM
CalviŐ˛
CalviŐ˛ - avatar
+ 1
Overloading Function will help you
1st Oct 2017, 1:55 PM
Kartikey Sahu
Kartikey Sahu - avatar
0
it will cause an error and it is not good programming practice
1st Oct 2017, 1:29 PM
Joshua
Joshua - avatar
0
sorry, it does not, but it still is not good practice
1st Oct 2017, 4:47 PM
Joshua
Joshua - avatar