# Pure Function

A function that produces the same result for the same inputs without changing outside state.

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

**Pure Function** — A function that produces the same result for the same inputs without changing outside state.

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

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

Updated: September 27, 2026

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