有人可以解释为什么harvesters[i]
会undefined
在这种情况下返回吗?我之前使用过类似的代码,没有任何问题。这是为了游戏 Screeps。
var harvesters=_(Game.creeps).filter( { memory: { role: 'harvester' } } );
for(var i in harvesters)
{
//console.log(harvesters[i]); //this is the debug code I mention below
harvesters[i].memory.sourceid=0;
}
}
经过一些测试(感谢评论)我发现harvesters[i]
没有返回我期望的收割机对象....每个harvester
显然都是一个实例
function wrapperValue() {
return baseWrapperValue(this.__wrapped__, this.__actions__);
}
当我尝试将其输出到控制台时。为什么这不是蠕变物体?