Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/426.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 TypeError:(fn)在仅执行函数时不可编辑_Javascript_Node.js - Fatal编程技术网

Javascript TypeError:(fn)在仅执行函数时不可编辑

Javascript TypeError:(fn)在仅执行函数时不可编辑,javascript,node.js,Javascript,Node.js,所以我有一个非常简单的代码: // doesn't matter, just be sure that we have an array const tasks = Array.isArray(result) ? [...result] : [result]; // works for (let i = 0; i < tasks.length; i++) { this.executeNativeCommand(tasks[i].command, ...tasks[i].args)

所以我有一个非常简单的代码:

// doesn't matter, just be sure that we have an array
const tasks = Array.isArray(result) ? [...result] : [result];

// works
for (let i = 0; i < tasks.length; i++) {
    this.executeNativeCommand(tasks[i].command, ...tasks[i].args);
}

// TypeError: this.executeNativeCommand is not iterable (cannot read property Symbol(Symbol.iterator))
tasks.forEach(task => {
    this.executeNativeCommand(task.command, ...task.args);
});
//没关系,只要确保我们有一个数组就行了
const tasks=Array.isArray(结果)?[…结果]:[结果];
//工作
for(设i=0;i{
this.executentiveCommand(task.command,…task.args);
});

还尝试了
这个['executentiveCommand']
-它成功了。这是什么魔法?

消息是错误的和令人困惑的,它应该是
任务[i]。args不可编辑
/
任务。args不可编辑

你可能遇到了


那是三个月前(2020年2月),但它似乎还没有登陆stable node.js或Chrome。

Huh。只是尝试了一下,同样的结果,但即使是你写的“作品”也会给我造成同样的错误。等等,我正在试图弄清它的底细箭头函数没有
这个
:使用普通函数或绑定它是的,但外部代码会有它。我尝试过,但它在两种方式下都有效。导致问题的确切代码是什么?有时人们会简化它,它会消除错误。哇。你是骑士。谢谢!