Home >Web Front-end >JS Tutorial >Understand the concept of no function overloading in javascript through examples_javascript tips
Imagining function names as pointers also helps to understand why there is no concept of function overloading in ECMAScript. Example below:
Obviously, in this example, two functions with the same name are declared, and the result is that the later function overwrites the previous function. The above code is actually identical to the code below.
By looking at the rewritten code, it’s easy to see what’s going on. When you create the second function, you actually overwrite the variable addSomeNum that references the first function.
The above is the entire content of this article, I hope you all like it.