How to pass parameters on the type of javascript
The purpose of this article is to share with you about how javascript types pass parameters. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Description
1. The formal parameter of a function can also be regarded as a variable.
2. When we pass a variable of value type as a parameter to the formal parameter of the function, we actually copy the value of the variable in the stack space to the formal parameter.
3. Modifying the formal parameters inside the method will not affect the external variables.
Example
Function fun (a) {astatine; console.log (a); / / a = 11} var x = 10 / / the essence of passing argument x to formal parameter a / / is to make a copy of the value passed by x = 10 to a Magi x itself and will not change with a / / that is, any modification to formal parameter (a) within the method will not affect the external variable (x) fun (x); console.log (x); / / x = 10 Thank you for your reading! This is the end of the article on "how to pass parameters on the types of javascript". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!