クラスのメソッドの 1 つで forEach を使用して、配列を反復処理しています。forEach 内のクラスのインスタンスにアクセスする必要がありますが、これは未定義です。
var aGlobalVar = {};
(function () {
"use strict";
aGlobalVar.thing = function() {
this.value = "thing";
}
aGlobalVar.thing.prototype.amethod = function() {
data.forEach(function(d) {
console.log(d);
console.log(this.value);
});
}
})();
var rr = new aGlobalVar.thing();
rr.amethod();
ここで取り組んでいるフィドルがあります: http://jsfiddle.net/NhdDS/1/。