Learn about the function overload you learn when using a function in web What is this and what is the difference in Java and JavaScript?
# Function overloading
First, let's look at the function overload. Function overload can be thought of as overloading ~ something is transmitted and read in advance, i.e. it is the parameters that are passed on to the function and how the passed factor is read. I'll explain how to do that below.

Function (method) names are the same, but factors (parameter) are of different type and number

As shown above, the name is the same, but it means that the type or number of factors to be passed on is different. It means proclaiming Java, for example: If you create a function doubleNum(), which returns twice the value ~
void doubleNum(int num) {
  printLn(num * 2);
The above function doubleNum() takes one factor of int type, multiplies by * 2, and returns it. But what happens if you re-declare a function with the same name as below and change the type and number of factors?
void doubleNum(int num1, int num2) {
  printLn((num1 + num2) * 2);
//  Returned by adding two values and then two

void doubleNum(string num) {
  printLn('Current value is ' + num);
// If text type, print the value

As you can see, the functions of the same three names have been declared, but you can make them all perform different actions. Think of it as overloading. This means that you can do the same without overloading, but overloading has the following benefits:

- No need to create multiple functions that perform similar functions

The more complex and longer the code, the greater the advantage. Overloading is essential if the same function must be used multiple times.

! Function overload of JavaScript

Although no overload exists in JavaScript, the behavior can be made equal. JavaScript cannot rename the same function first. Even though the number of factors is different, the function declared first is re-declared as the function after. In other words, only the following functions will function:
function doubleNum(num) {

function doubleNum(num) {

// Only 20,000 outputs when run

And because JavaScript does not specify type declarations, there can be no function declarations based on type.