# Variable Scope Basics in JavaScript | kirupa.com

**URL:** <https://forum.kirupa.com/t/variable-scope-basics-in-javascript-kirupa-com/633687>\
**Category:** programming\
**Created:** [August 27, 2015, 12:33pm UTC](https://forum.kirupa.com/t/variable-scope-basics-in-javascript-kirupa-com/633687 "2015-08-27T12:33:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [August 27, 2015, 12:33pm UTC](https://forum.kirupa.com/t/variable-scope-basics-in-javascript-kirupa-com/633687/1 "2015-08-27T12:33:03Z")

</div>

by [kirupa](http://www.kirupa.com/me/index.htm) | 20 February 2014

Let's revisit something relating to [variables](http://www.kirupa.com/html5/variables_in_javascript.htm). Each variable you declare has a certain level of visibility that determines when you can actually use it. In human-understandable terms, what this means is simple. Just because you declare a variable doesn't mean that it can be accessed from anywhere in your code. There are some basic things you need to understand, and this whole area of understanding this falls under a topic known as **variable scope**.

* * *
This is a companion discussion topic for the original entry at [http://www.kirupa.com/html5//variable\_scope\_js.htm](http://www.kirupa.com/html5//variable_scope_js.htm)
