像往常一样简单粗暴地看码:

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:

function add (a,b){ return a + b ;}

add(1,2);

Here a and b are the parameters, and 1and 2 are the arguments.

 简单明了,在我们定义一个fu function 的时候,传参传的是形参 parameter,当我们调用定义好的 function 的时候,传参传的是实参,而 arguments 是像数组一样的东西,注意,这货不是数组,这货是个 object,但是他是你传的实参的集合,即使你的 function 不需要传参,它也是存在的,只不过里面没东西而已。

相关文章:

  • 2021-08-16
  • 2022-12-23
  • 2021-08-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-05
  • 2021-10-12
  • 2022-12-23
  • 2021-05-15
  • 2022-02-07
  • 2021-07-19
  • 2021-12-21
相关资源
相似解决方案