Which of the following is true about the this keyword in JavaScript arrow functions?

Which of the following is true about the this keyword in JavaScript arrow functions?

a) this refers to the global object
b) this is lexically bound
c) this refers to the parent function’s scope
d) this is dynamically bound

Answer:

b) this is lexically bound

Explanation:

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.

Reference:

JavaScript MCQ (Multiple-Choice Questions)

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top