function arguments
When defining a function, parameters are formal parameters
In addition to the above methods, we can also manage parameters through the arguments array object (js built-in object)
Description: One parameter will be saved to the first element of arguments, and the second parameter will be saved to the second element of arguments. . and so on
The return value of the function:
The function does not have to return a result, it depends on the requirements, if no result is returned, then the received is undefined
js closure features:
What is a closure?
When we define a function inside a function, the inner function will include the final value of the variable of the outer function and save it in memory, similar to the static variable of php
What will the closure lead to,
Inner function, which saves the final value of the variable in the outer function to memory
In this way, an opportunity is provided: outside the function, the value inside the function can be read;
How to solve problems caused by closures