i'm unsure about accessing this
context in ECMAScript 6 class .
In this example I want to call the method addItem(..)
of the Class {this.addItem(data.points);}
How do I bind the this-Conext of the class correctly?
class TEST {
constructor() {}
testMethod() {
for (let i = 1; i <= 10; i++) {
$.getJSON("test/" + i + ".json", function (data) {
this.addItem(data.points);
});
}
}
}