Which of the following is true regarding the 'this' keyword inside an arrow function?
- The 'this' keyword in an arrow function refers to the global object.
- The 'this' keyword in an arrow function refers to the object that contains the arrow function.
- Arrow functions do not have a 'this' keyword.
- The 'this' keyword in an arrow function refers to the 'this' value of the containing lexical context.
In arrow functions, the value of 'this' is inherited from the surrounding lexical context, which means it refers to the 'this' value of the containing function or block. Unlike regular functions, arrow functions do not have their own 'this' binding.
Loading...
Related Quiz
- In JavaScript, the ______ method is used to iterate over all enumerable properties of an object.
- What is the primary purpose of using JSON Web Tokens (JWT) in authentication?
- When destructuring arrays, using the rest operator will result in a new array containing the ______ elements.
- Utilizing closures with caution is essential as they can lead to potential memory leaks due to retained ________.
- Which of the following is the primary role of middleware in Express.js?