← Quiz: Scope, Closures, Hoisting and this: all 15 questions
Quiz: Scope, Closures, Hoisting and this · Question 9 of 15
Why does an arrow function used inside a method see the method's this?
Why does an arrow function used inside a method see the method's this?
- A.Arrow functions always point to window
- B.Arrow functions have no own this, so they use the this of the surrounding code
- C.Arrow functions copy the object
- D.Because of hoisting
Answer & explanation
Correct answer: Arrow functions have no own this, so they use the this of the surrounding code
Arrow functions borrow this lexically, which is handy for callbacks inside methods.
Can you get the rest right without peeking?
Take the timed Quiz: Scope, Closures, Hoisting and this quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →