I want my code to be DRY which is why I wrote a function which gets a variable as an argument, which I'm giving a value in that function.
Simplified code:
private bar: boolean | undefined;
private foo(variable: boolean): void {
variable = true;
}
this.foo(this.bar);
The variable bar stays undefined and I don't get why. Seems like I don't understand something very fundamental. Anyone can help?