Modern JavaScript (ES6+) for Beginners
Lesson 3 of 12 25% of course

Arrow Functions Explained

1 · 5 min · 6/7/2026

Learn Arrow Functions Explained in our free Modern JavaScript (ES6+) for Beginners series. Step-by-step explanations, examples, and interview tips on Toolliyo Academy.

Sign in to track progress and bookmarks.

Arrow Functions Explained
Lesson 3 of 12 · Part 1 — Modern Basics · Modern JavaScript (ES6+) for Beginners
Course: Modern JavaScript (ES6+) for Beginners · Lesson: 3/12 · Read time: ~16 min · Level: Beginner · ES version: ES2015 (ES6) and above

Arrow Functions Explained

Arrow functions (=>) are a shorter way to write functions. They appear in React event handlers, array methods, and Node.js middleware. Every modern codebase uses them daily.

Syntax comparison

// Old way
function add(a, b) {
  return a + b;
}

// Arrow function — same behavior
const add = (a, b) => a + b;

// Multiple lines — use { } and return
const greet = (name) => {
  const msg = 'Welcome, ' + name;
  return msg;
};

When to use arrow functions

  • Callbacks: items.map(item => item.price)
  • Short helpers: const double = n => n * 2
  • React: onClick={() => setOpen(true)}
🌍 Real-world example — Filter paid invoices
const invoices = [
  { id: 1, amount: 500, paid: true },
  { id: 2, amount: 1200, paid: false },
  { id: 3, amount: 799, paid: true }
];

const paidTotal = invoices
  .filter(inv => inv.paid)
  .map(inv => inv.amount)
  .reduce((sum, amt) => sum + amt, 0);

console.log(paidTotal); // 1299

Arrow vs regular function — this

Arrow functions do not have their own this. They inherit this from the surrounding scope. That is why React class components used bind(), but functional components + arrows “just work”.

const timer = {
  seconds: 0,
  start() {
    setInterval(() => {
      this.seconds++;  // ✅ this = timer object
    }, 1000);
  }
};
⚠️ Common Mistake: Using arrow functions as object methods when you need dynamic this — use regular function syntax for methods: start() { } not start: () => { } in some cases.
💡 Tip: If the body is one expression, you can omit return and braces: x => x * 2.
👨‍🏫 Teaching note: Have students rewrite three old function declarations as arrows — muscle memory before React.

Continue learning

Previous: let, const & Block Scope

Next: Template Literals & Modern Strings

Course home: All 12 lessons

Test your knowledge

Quizzes linked to this course—pass to earn certificates.

Browse all quizzes
Modern JavaScript (ES6+) for Beginners

On this page

Syntax comparison When to use arrow functions Arrow vs regular function — this Continue learning
Part 1 — Modern Basics
Introduction — Why ES6+ Before Node.js & React let, const & Block Scope Arrow Functions Explained
Part 2 — Write Less Code
Template Literals & Modern Strings Destructuring — Arrays & Objects Spread & Rest Operators (...)
Part 3 — Data & Collections
Default Parameters & Object Shorthand Array Methods — map, filter, find & reduce for...of, Sets & Maps Essentials
Part 4 — Async & Modules
Promises — then, catch & finally async/await & Fetch API Modules — import/export & What to Learn Next
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details