1. Creation of functions
in the the keyword for creating functions inside JavaScript is function
Function Name: It is the identifier that needs to be written when we call the functions
Formal parameter: All called formal parameters, when calling a function, what are the parameters required for this function?
Arguments: All called actual parameters, when the function is called, the parameters actually passed to the function
Call to function
The method is very simple, just write the function name, followed by a pair of parentheses. Note that you need to write parentheses whenever you call a function, regardless of whether it is a parameter or not.
2. parameters of the function
(1) parameter names of parameters can be repeated, parameter parameters of the same name take the last value
(2) even if a function declares a formal parameter, it can be called without passing the argument value
(3) when calling a function, you can pass several argument values to the function, regardless of the number of parameters required by the formal parameter declaration .
Inside the function, there is a pseudo-array object. The so-called pseudo-array refers to arrays that look like arrays, but are not really.
We can use the array method to test whether the arguments is an array
Its role is to store the arguments that pass over.
3. return value of function
when the function is finished, we can return a value and return the value of the keyword .
It is important to note that once the function is run to return, the function is finished. In other words, The statement after return is not executed
Return can only return one number at a time, but if you want to return multiple numbers, put multiple numbers in the array and return to the array.
Basic description of JS function