I use method overloading as below in my Javascript code.
function somefunction()
{
//1st function
}
function somefunction(a)
{
//2nd function
}
function somefunction(a,b)
{
//3rd function
}
somefunction(); // function call goes here
What I don't understand is if I call the somefunction()
javascript should call the 1st function but the problem is javascript actually calls the 3rd function. Why is that? How can I call the 1st and 2nd function ? What is the reason for this? Is there a proper way to implement method overloading in Javascript? What's the industry standard?