Lets say I have this Object:
api = {
x: 2,
func: () => {
this.x
}
}
If I call api.function, how come this
is scoped to the window
and not api
?
If I turn func into a regular anonymous function this
is scoped to the api
and not the window
.
Can anyone explain this to me? I thought the arrow notation inherited the parent this, which is api