Write reusable blocks with functions. Pass data via parameters. Understand global vs local scope.
// Function - reusable brew
function makeCoffee(shots) {
return "Espresso x" + shots;
}
makeCoffee(2); // "Espresso x2"
// Arrow function (modern)
const total = (price, qty) => price * qty;
Variables inside functions are local — invisible outside. Global = entire script.
Pass info into functions. Return sends a value back out.