RSRobince Studio

Arrow Functions

Arrow functions give you a shorter way to write functions. They use the => syntax and are great for short, single-purpose helpers.

A single expression body returns automatically, so you can drop the return keyword and the braces.

const add = (a, b) => a + b;
const square = n => n * n;
const greet = () => "Hello!";
  • One parameter needs no parentheses: n => n * n
  • A block body uses braces and an explicit return
  • Arrows do not have their own this binding
Use arrow functions for short callbacks; keep named functions for larger, reusable logic.
Try it yourself

Loading editor…