Caffeinated Coder
Book an appointment
Lesson 07 · Basics

Functions

A function is a named list of steps you write once and run whenever you call it. Follow a seven-line script that prices two orders with one function, total(price, count): each call hands in arguments, gets its own call frame of local variables, and return sends one value back to the line that called. console.log then prints 22.

10 min11 steps5 questionsBeginner
Fig 7 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.