【发布时间】:2017-04-23 11:30:59
【问题描述】:
我在一个我不太了解的小程序上遇到了这个问题(我对node red有点陌生),代码是
var profile = msg.user.profile;
var cart = profile.cart = profile.cart || [];
var search = profile.search;
var id = msg.payload.substring(8);
for (let item of search){
if ( item.id != id) continue;
cart.push(item);
msg.payload = item;
}
并且完整的错误是TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined 在行for (let item of search){。
我做了一些研究,发现这个错误通常是由于未定义的东西造成的,但我真的不明白如何解决这个问题。
【问题讨论】:
标签: javascript node-red