小编Mal*_*lte的帖子

如何修复“类型错误:(图像 || []).forEach 不是函数”

在 Node.js(正在使用 MS Bot Framework)中,我尝试迭代包含 . 返回的多个对象的数组fetch()它执行一次迭代,然后抛出一个错误。

\n\n

我确实已经将节点获取从等式中剔除,并使用了对象的静态数组。我也尝试转换为数组。结果还是一样:TypeError: (images || []).forEach is not a function第一次迭代进展顺利。

\n\n

这是目前的样子(为了可读性缩短了对象值):

\n\n
// exact copy of what fetch returns\nlet test = [\n    {\n        title: 'Power BI Desktop\xe2\x80\x94Interactive Reports | Microsoft Power BI',\n        link: 'https://support.office.com/',\n        description: 'Create interactive reports with data',\n        thumbnail: 'https://powerbi.microsoft.com/'\n    }, {\n        title: 'What is Power BI administration? - Power BI',\n        link: 'https://support.office.com/',\n        description: 'Learn about the configuration of Power BI ',\n        thumbnail: 'https://learn.microsoft.com/'\n    }, {\n …
Run Code Online (Sandbox Code Playgroud)

javascript arrays node.js botframework

2
推荐指数
1
解决办法
3671
查看次数

标签 统计

arrays ×1

botframework ×1

javascript ×1

node.js ×1