Skip to content
dreamcode
dreamcode
Map
Functions
Lesson 5 of 48
+15 XP on finish
JAVASCRIPT CLIMBSChapter 1 · JS Basics

Arrow Functions

JavaScript functions can be written using the compact arrow function syntax. They bundle reusable logic under a name.

Worked example

How it reads

  • const greet = (name) => { ... } defines an arrow function
  • Inputs go in parentheses, followed by the fat arrow =>
  • return passes the value back to the caller
Cloud tip: Arrow functions are the standard in modern JavaScript and React development.
index.js
JAVASCRIPT
real JavaScript, runs in your browser
Console
Run your code to see its output here.
YOUR TURN

Write an arrow function square that returns n times n, and log square(9): 81.

Press Run to check your work.