# Lexical Scope

*noun*

say it: **“LEK-sih-kul skohp”** **/ˈlɛksɪkəl skoʊp/**

The rule that a function can see the variables around the place where it was written, not the place where it is called.

## What is **Lexical Scope** in JavaScript?

**Lexical Scope** — The rule that a function can use names from where it was written.

```javascript
const taxRate = 0.08;

function addTax(price) {
    const tax = price * taxRate;
    return price + tax;
}
```

## In a sentence

- “Because of **lexical scope**, the inner function reads the greeting from the function it's written inside, no matter who calls it.”

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

Updated: November 9, 2026

Source: https://www.ask-codey.com/glossary/lexical-scope
