How do arrow functions differ from regular functions?

Understand the differences in scope, this binding, and syntax between arrow and traditional functions.

beginnerFundamentalsjavascriptarrow functionsthis
Published: 11/3/2025
Updated: 11/3/2025

Question

How do arrow functions differ from regular functions?


Answer

Arrow functions are lexically scoped — they don’t create their own this, arguments, or prototype.

function Regular() {
  this.name = 'Regular';
  setTimeout(function () {
    console.log(this.name);
  }, 0);
}

function Arrow() {
  this.name = 'Arrow';
  setTimeout(() => {
    console.log(this.name);
  }, 0);
}

new Regular(); // undefined
new Arrow(); // "Arrow"

They’re shorter, cleaner, and ideal for callbacks or array methods.

Real-World Example

Use arrow functions for event handlers in React or callbacks in array methods:

numbers.map((n) => n * 2);

Quick Practice

Convert a traditional function to an arrow function that logs the square of a number.

Summary

Arrow functions are concise, modern, and bind this automatically — perfect for most use cases.

Related Videos
Watch these videos to learn more about this topic
Frequently Asked Questions

Can arrow functions be used as constructors?

No. Arrow functions don’t have their own this or prototype, so they can’t be used as constructors.


Stay Updated

Get the latest frontend challenges, interview questions and tutorials delivered to your inbox.