---
title: Local variable
slug: Glossary/Local_variable
tags:
  - CodingScripting
  - Glossary
  - NeedsContent
---
A {{glossary("variable")}} whose name is bound to its {{glossary("value")}} only within a {{Glossary("local scope")}}.

## Example

```js
var global = 5; //is a global variable

function fun(){
    var local = 10; //is a local variable
}
```

## See also

- {{interwiki("wikipedia", "Local variable", "Local variable")}} on Wikipedia
