Lesson 4 — Functions
Functions
A function groups reusable code under a name. The modern arrow form, const double = (n) => n * 2, is short and everywhere in JavaScript.
Why it matters: functions are the core building block of every JS app — you will pass them around, reuse them and combine them constantly.
Tip: an arrow function with no braces returns its expression automatically; add braces and you must write return yourself.
Write double(n) returning n*2, then log double(7).
Ready for more? These paid resources pick up where this lesson leaves off.
Project-based JavaScript Foundations video courses — the perfect paid next step after these free lessons.
Browse on Udemy →Hand-picked JavaScript Foundations books to master the fundamentals offline.
See on Amazon →Some links on this page are affiliate links: we may earn a commission at no extra cost to you. We only recommend tools we believe are genuinely useful.