I encountered an issue where I am attempting to access an outer variable within a nested function, but my debugger keeps showing the variable as undefined:
export class TestClass {
someObj = [ { id=1 }];
changeData() {
const someId = 1;
const test = {
attr: function() { return (this.somObj.find(x => x.id === someId )); }
};
}
}
The problem is that this.someObj is coming up as undefined. Is there a way to solve this?