Ensuring a given this

If you want something done, do it yourself… Offloading the control of this to our caller code when we can perfectly well ensure it ourselves is irresponsible and sometimes unfeasible. What if we exposed a method reference that was guaranteed properly-bound for life?
Ensuring a given this
bind()
5 mins
Re-implementing bind()
7 mins
Re-implementing bind(): visual run-through
4 mins
The binding operator
3 mins
Explicit guarantee in the constructor
5 mins
Implicit guarantee by field initializer + arrow function
3 mins
Explicit guarantee by decorator
3 mins
Want more video courses?
3 mins
Further reading…