AI

The this keyword refers to the object it belongs to. However, it can lose context when passed around.

Your Task:

  • We have an object person with a greet method
  • When we assign person.greet to greetFn, it loses context (this becomes undefined or global)
  • Fix this by binding greetFn to person using .bind()
  • Call the bound function
TypeScript Solution
Loading...

Submit your code to see test results