# Lexical Scope

The rule that a function can use names from where it was written.

## 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;
}
```

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/lexical-scope
