When should you use an arrow function vs a regular function in JavaScript?
Use arrows for short callbacks and when you want lexical this (inside methods, constructors). Use regular functions when you need this at call time, the arguments object, or constructor functionality (new).
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in Function Declarations vs Expressions vs Arrows in JavaScript
Declarations are hoisted with their full body. Expressions are variable-assigned (variable hoisting only). Arrows are always expressions with lexical this, no arguments object, and cannot be used as constructors.
No. Arrow functions inherit this from their enclosing lexical scope. call, apply, and bind cannot change an arrow's this. This is why arrows fix the this-in-callback bug inside methods and constructors.
No. Arrow functions do not have their own arguments object. If you reference arguments inside an arrow, it refers to the enclosing regular function's arguments. Use rest parameters (...args) in arrows instead.
Still have questions?
Browse all our FAQs or reach out to our support team
