Possible Duplicate:
Self Executing function doesnt work?
In Javascript, why does
function() { console.log('hello'); }();
give an error, but
function() { console.log('hello'); }()
not?
Edit: some answers state that both give syntax errors in Firefox, but this does not seem to be the case in either Chrome or a Node.js REPL. Additionally,
(function() { console.log('hello'); }());
seems to work fine in Firefox.