In the ECMAScript language, the function name is simply a pointer (which can be considered a reference), the following code:
"Use strict"; function sum (A, b) { return a+b;} Console.log (sum), var sum2 = Sum;sum = Null;console.log (sum2 (3,3));
Output: 3, 6;
The code can see that we define the function, in fact the function name is a pointer, pointer to the heap memory that block the definition of the function, we can save this address several.
Let's take a look at the "reload" (the quoted accent is not true):
"Use strict"; function Addsomenumber (num) { return num + 100;} function Addsomenumber (num,add) { return num + add;} Console.log (Addsomenumber (10));
What the result is:NaN
The above code can be equivalent to the following writing:
"Use strict"; var addsomenumber = function (num) { return num + 100;}; Addsomenumber=function (num,add) { return num + add;}; Console.log (Addsomenumber (10));
By this equivalent code, we can easily see that when we define a function with the same name, the equivalent function pointer points to other code definitions.
JavaScript no overloading function without overloading said