There is a special data type---function type in JavaScript, and every function of JavaScript is an instance of a function type. Because a function is an object, the function name is actually a pointer to a function object and is not bound to a function.
<pre name= "code" class= "HTML" >function sum (num1,num2)
{return
num1 +num2;
}
Alert (sum (10,10));
var other = sum;
Alert (Other (10,10));
sum = null;
Alert (Other (10,10)); 20
The function name as a pointer to a function helps to understand why there is no concept of a function overload in ECMAScript
function sum (NUM1)
{return
num1 +100;
}
function sum (NUM1)
{return
num1 +200;
}
Alert (sum (200)); 400
Although two functions with the same name are declared, the following function overrides the previous function, which is equivalent to the code below
function sum (NUM1)
{return
num1 +100;
}
sum = function (NUM1)
{return
num1 +200;
}
Alert (sum (200)); 400
When you create the second function, you actually overwrite the first function variable of the reference. Sum