I just read a great article about JavaScript Scoping and Hoisting by Ben Cherry in which he gives the following example:
var a = 1; function b() { a =
function a() { } is a function statement, which creates an a variable local to the b function. Variables are created when a function is parsed, regardless of whether the var or function statement gets executed.
function a() { }
a
b
var
a = 10 sets this local variable.
a = 10