Possible Duplicate:
Difference between (function(){})(); and function(){}();
Are “(function ( ) { } ) ( )” and “(function ( ) { } ( ) )” functionally equal in JavaScript?
I just wondered whether there is a difference (regarding the functionality) between these two examples:
1st
(function foo() {
console.log("bar")
})()
2nd
(function foo() {
console.log("bar")
}())
Both seem to work fine ...
Thanks!
function greet()
, though valid, doesn't make sense. Justvar greet = function ()
is all that's needed. – Photophore