+25 XP
Lesson 45

Arrow Functions

Modern shorthand syntax!

Arrow Functions =>

A shorter way to write functions using the arrow =>

Old Way:

function greet() {
  return "Hello!";
}
                  

Arrow Function:

const greet = () => {
  return "Hello!";
}
                  

Why use arrow functions?

  • Shorter and cleaner code
  • Modern JavaScript style
  • Great for simple functions