I’ve been looking for information about immediately invoked functions, and somewhere I stumbled on this notation:
+function(){console.log(\"Something.\")}()
So the short answer is that it prevents a syntax error, by using the function results in one way or another.
You can also instruct the engine that you're not even interested in the return value by using the void operator:
void function() { console.log("Foo!"); }();
Of course, putting braces around the whole thing also serves that purpose.