# Function

A reusable block of code that can receive values and return 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;
}
```

Level: Apprentice · [More JavaScript terms at this level](https://www.ask-codey.com/glossary/subjects/javascript/apprentice)

Updated: September 27, 2026

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