Skip to content

Arrow functions

  • A shorter way to write a function: const square = (n) => n * n;.
  • With a single expression after =>, the value is returned automatically — no return, no { }.

function square(n) { return n * n; } becomes the arrow function const square = n => n * n; square(4) is 16

Handout

Log in or create account

IGCSE, A-Level & AP