Hiprup

What is the difference between a regular function and arrow function?

Arrow functions differ from regular functions in several behaviours.

  • this — arrows inherit it lexically; regular functions set it by call site.

  • arguments — only regular functions have it.

  • new — only regular functions can be constructors.

  • Syntax — arrows allow implicit returns.

Use regular functions for methods and constructors; arrows for callbacks and short helpers.

this is the #1 difference. Arrow = lexical this (inherits from parent). Regular = dynamic this (depends on call).

No arguments (use ...rest). No new. No prototype.

These five differences cover every interview question about arrow functions.

What is the difference between a regular function and arrow function? | Hiprup