javascript 中的 parameter vs arguments
像往常一样简单粗暴地看码:
A parameter is the variable which is part of the method’s signature (method declaration). An argument is an expression used when calling the method. Consider the following code:
Here a and b are the parameters, and 1and |
简单明了,在我们定义一个fu function 的时候,传参传的是形参 parameter,当我们调用定义好的 function 的时候,传参传的是实参,而 arguments 是像数组一样的东西,注意,这货不是数组,这货是个 object,但是他是你传的实参的集合,即使你的 function 不需要传参,它也是存在的,只不过里面没东西而已。
To Be Architectures But Not Code Monkeys.
The Only Way To Do Great Work Is To Love What You Do.
Myths Are Public Dreams While Dreams Are Personal Myths.
The Only Way To Do Great Work Is To Love What You Do.
Myths Are Public Dreams While Dreams Are Personal Myths.