Which of the following is true about the this keyword in JavaScript arrow functions?
a)
this
refers to the global objectb)
this
is lexically boundc)
this
refers to the parent function’s scoped)
this
is dynamically boundAnswer:
b)
this
is lexically boundExplanation:
In arrow functions, the this
keyword is lexically bound, meaning it inherits this
from the surrounding context where the function is defined. Unlike regular functions, this
in arrow functions does not depend on how the function is called.