Engrain by ByteRush

JS.03 3 concepts · 3 ready

this, call, apply and bind

Determine `this` in any call and control it.

  1. JS.03.01The four rules of `this`CoreJunior10 min
  2. JS.03.02Arrow functions and lexical `this`CoreJunior9 min
  3. JS.03.03call, apply and bind in depthCoreMid-level10 min

Interview questions in this module

  1. How is this determined in JavaScript? List the rules in order of precedence.
  2. What is the difference between call, apply and bind?
  3. Why does const f = obj.method; f() lose this?
  4. How do arrow functions handle this? When should you not use an arrow function?
  5. What does this refer to inside an event listener?
  6. Implement Function.prototype.bind.