# Function

*noun*

say it: **“FUNK-shun”** **/ˈfʌŋkʃən/**

A named, reusable block of code that does one job. You can hand it values, and it can hand back a result.

## What is **Function** in JavaScript?

**Function** — A reusable block of code that can receive values and return a result.

```javascript
function total(price, quantity) {
    return price * quantity;
}
```

## In a sentence

- “I wrote a **function** called addTip so every receipt works out the tip the same way.”

Level: Apprentice · [More JavaScript terms at this level](https://www.ask-codey.com/glossary?category=javascript&level=2)

Updated: November 9, 2026

## In other subjects

- [Function in PowerShell](https://www.ask-codey.com/glossary/function-powershell)
- [Function in Python](https://www.ask-codey.com/glossary/function-python)

Source: https://www.ask-codey.com/glossary/function
