There is a Class and inside if this class I'm trying to fill up an array winch was defined in 'constructor'.
class ClassA {
constructor(){
...
this.place = [];
}
fillUp() {
fetch(path)
.then(function(response) {
return response.json();
}).then(function(result) {
this.place.push({"result":result})
})
}
}
inst = new ClassA();
inst.fillUp();
As a result i got this error: TypeError: Cannot read property 'place' of undefined. Where could be the problem?