Why is the result of TypeScript delegates not equal?
someProperty: any;
someActionsWithItems(item: any) {
this.someProperty = "test";
}
// When using 'this', it works fine:
this.array.forEach(item => this.someActionsWithItems(item));
// However, if we use this approach, an error occurs because the context of 'this' isn't initialized (Cannot set property 'someProperty' of undefined):
this.array.forEach(this.someActionsWithItems);
What could be causing this discrepancy?