2018-10-12 15:37:13 -04:00
---
title: Local Scope and Functions
---
2019-07-24 00:59:27 -07:00
# Local Scope and Functions
2018-10-12 15:37:13 -04:00
2019-07-24 00:59:27 -07:00
---
## Problem Explanation
2018-10-12 15:37:13 -04:00
Local scope means that the variable is available within a certain area. In the case of this exercise, `myVar` is only available within the function, and not anywhere outside.
2019-07-24 00:59:27 -07:00
---
## Solutions
< details > < summary > Solution 1 (Click to Show/Hide)< / summary >
2018-10-12 15:37:13 -04:00
```javascript
function myLocalScope() {
var myVar;
console.log(myVar);
}
myLocalScope();
```
2019-07-24 00:59:27 -07:00
#### Code Explanation
* The variable only exists in the function. Outside the function, it is non-existent.
< / details >