JavaScript Category
FUNCTION
Reusable unit of behavior.
Definition
A function is a named or anonymous block of logic that can be invoked with inputs and can return outputs. It helps teams break large workflows into smaller, testable parts.
Practical Example & Use Case
In a checkout feature, engineers often move tax calculation into a dedicated function so pricing logic stays consistent across web, API, and background jobs.
Editorial review date: 2026-03-10