← Quiz: Scope, Closures, Hoisting and this: all 15 questions
Quiz: Scope, Closures, Hoisting and this · Question 8 of 15
For a normal (non-arrow) function, what decides the value of this?
For a normal (non-arrow) function, what decides the value of this?
- A.Where the function is written in the file
- B.How the function is called
- C.The name of the function
- D.The number of arguments
Answer & explanation
Correct answer: How the function is called
obj.method() gives obj; a bare call gives undefined in strict mode; bind, call and new set it explicitly.
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 →