Function Path
Functions name a reusable task. Begin with inputs, calculate a result, then return that result to the caller.
Where to run this
This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.
A practical example
function total(price, quantity) {
return price * quantity;
}
console.log(total(6, 3));
What happens
The function returns 18.