Which of the following scenarios is NOT recommended for using arrow functions?

  • As event handlers in the DOM.
  • As methods within objects.
  • In callbacks where "this" context matters.
  • In short, simple functions.
Arrow functions are not recommended for use as event handlers in the DOM. This is because the value of "this" in an arrow function is not determined by the event but instead retains the value from its enclosing lexical context, which may not be what you expect in an event handler. Traditional functions are usually preferred for event handlers.
Add your answer
Loading...

Leave a comment

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