Caffeinated Coder
Book an appointment
Lesson 14 · How JavaScript really works

How this works

Inside a normal function, this is not fixed where the function is written: it is set every time the function is called, by the way it is called. Follow one function, hi, shared by two objects and called five ways: as cat.hi() and dog.hi(), with call, through bind, and as a plain f() that ends in a TypeError.

11 min11 steps5 questionsIntermediate
Fig 14 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.