arguments 就是参数的意思 这个函数是为了求和,所以参数的数量不是固定的,可能是 sum(1,2),可能是 sum(1,2,3) Since the parameters are not fixed then we need to get the parameters Look at the following code
arguments is a built-in attribute of the current function. It is an array-like array that stores the actual parameters of the incoming function. The length is the number of incoming actual parameters. The meaning of this code is to find 1+2+3+4+ Value of 5
arguments
就是参数的意思这个函数是为了求和,所以参数的数量不是固定的,可能是
sum(1,2)
,可能是sum(1,2,3)
Since the parameters are not fixed
then we need to get the parameters
Look at the following code
For example, we enter
sum(1,2)
sum(1,2)
这时
arguments.length=2
arguments[i]
的值分别是1
和2
At this time, the values ofarguments.length=2
arguments[i]
are1
and2
arguments is a built-in attribute of the current function. It is an array-like array that stores the actual parameters of the incoming function. The length is the number of incoming actual parameters. The meaning of this code is to find 1+2+3+4+ Value of 5