I have a class like the following:
class SomeService {
constructor() {
this.classVar= [];
}
aFunction() {
myArray.forEach(function(obj) {
// how can I access classVar within this scope
});
}
So my question is how can I access the classVar
variable within forEach
block? what is the recommended approach here?