> For the complete documentation index, see [llms.txt](https://ysk.snesjhon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ysk.snesjhon.com/javascript/function/different-types-of-scopes.md).

# Different types of Scopes

### Global Scope

Any variable that's not inside a function or block (curly brace).

### Local Scope

Any variable declared inside a function

### Block Scope

This refers to `let` and `const` which unlike `var` are only accessible within the scope that they were defined.

### Lexical Scope

Lexical Scope (also known as Static Scope) literally means that scope is determined at the [lexing time](https://en.wikipedia.org/wiki/Lexical_analysis) (generally referred to as compiling) rather than at runtime.

### Dynamic Scope

Scope determined by the `this` keyword during function invocation.

## Resources

<https://blog.bitsrc.io/understanding-scope-and-scope-chain-in-javascript-f6637978cf53>
