JS: Module 3

← Dashboard
Module 3: The Assembly Line

Functions & Scope

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;
Pro Tip

Variables inside functions are local — invisible outside. Global = entire script.

Parameters

Pass info into functions. Return sends a value back out.