this & "binding"
Who am I?
Binding
The callback function given to setTimeout
is not bound to our Customer
instance. In addition to this, setTimeout
tries to help us by binding the timeout objet (which is as well returned by setTimeout) to our callback function.
In order to fix this issue, we should bind our instance of Customer
to callback function.
The hacky way
The other hacky way
The clean way
See you at the next chapter.
Last updated