var keyword is declared, the declaration is moved to the top of the variable's scope. The initialization still occurs in the same location that you entered it. This means that these variables can be used before they're declared. However, if you use the variable before it's been declared and/or initialized, the value will be undefined and your application may produce a bug because of this.
For more information on this topic, check out this blog post.