A function is a named sequence of statements that performs a task:
function greet() {
console.log("Hello!")
}
greet() // Prints: Hello!
greet() // Prints: Hello!
You define the function once, then call it by name whenever you need it. Functions let you avoid repeating code and give operations meaningful names.