Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/477.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Wsy此箭头函数没有';t与';参数。长度';?_Javascript_Arguments_Arrow Functions - Fatal编程技术网

Javascript Wsy此箭头函数没有';t与';参数。长度';?

Javascript Wsy此箭头函数没有';t与';参数。长度';?,javascript,arguments,arrow-functions,Javascript,Arguments,Arrow Functions,我想知道为什么下面名为“countArg2”的箭头函数不起作用。 有人能解释出什么问题吗 这很有效 这不管用。。 const countArg2 = () => arguments.length; countArg2(1, 2, 3); // VM6745:1 Uncaught ReferenceError: arguments is not defined 提前谢谢。您必须像这样解析arrow函数的参数 const countArg2=(…参数)=>arguments.leng

我想知道为什么下面名为“countArg2”的箭头函数不起作用。 有人能解释出什么问题吗


这很有效
这不管用。。
const countArg2 = () => arguments.length;
countArg2(1, 2, 3);
 // VM6745:1 Uncaught ReferenceError: arguments is not defined

提前谢谢。

您必须像这样解析arrow函数的参数

const countArg2=(…参数)=>arguments.length;
log(countArg2(1,2,3));
//VM6745:1未捕获引用错误:未定义参数
//在边缘(:1:29)

//at:2:1
Hi Suzuran:这里已经回答了:)->差异和限制->“没有
参数
,或者
新的.target
关键字。”
const countArg2 = () => arguments.length;
countArg2(1, 2, 3);
 // VM6745:1 Uncaught ReferenceError: arguments is not defined