'this'和我的变量在我的循环中未定义

时间:2017-05-29 02:24:29

标签: javascript arrays function loops variables

我的变量在循环访问时显示为未定义。我如何再次定义节点和'this'?

for (var i = 0; i < this._m.length; ++i) {
    this._v = this.m[i];
    this._n = this._v.m_Data.cCurrentNode(this.m_C);

    if (this._n && this._n.m_dataele.length) {
        for (var j = 0; j < this._n.m_dataele.length; ++j) {

            var visualObs = this.m_c.m_Con.getV();
            visualObs.forEach(function(visualObjects) {
                var a = visualObjects.getItems();
                area.forEach(function(a) {
                    var uniqueIdFull = a.UniqueId;
                    var uniqueId = uniqueIdFull.substring(0, uniqueIdFull.length-4);
                    if (id === uniqueId) {
                        //*************this._n = undefined && this = undefined
                    }
                });
            });
        }   
    }
}

0 个答案:

没有答案