# Memoization

Caching a function's result so repeated inputs can return it without recalculation.

## What is **Memoization** in JavaScript?

**Memoization** — Caching a function's result so repeated inputs can return it without recalculation.

```javascript
const cache = new Map();

function remember(key, calculate) {
    if (!cache.has(key)) {
        cache.set(key, calculate());
    }

    return cache.get(key);
}
```

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

Updated: September 27, 2026

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