The main practical difference is hoisting. For example:
foo(); // alerts 'hello'
function foo() {alert('hello');}
vs
foo(); // throws an error since foo is undefined
var foo = function() {alert('hello');}
Also, I think thatthis is undefined behavior
function foo(){
if (true) {
function bar(){}
}
bar();
}
Is technically invalid/undefined, but all browsers support so it really doesn't matterwhile this is ok.
function foo(){
if (true) {
var bar = function(){}
}
bar();
}