How to execute some javascript without modifying the global scope?
<p>I want to call some javascript code that for its own purposes needs to define some variables, but I want to isolate this so it doesn't pollute the global scope. So I wrap everything in an anonymous function object, call it immediately, and don't assign it or the result to anything:</p>

<pre><code>function() {
    var myInnerHelperFunction = function(object) {
        //do some work
    };

    var anObject = ...;

    myInnerHelperFunction(anObject);
}();
</code></pre>

<p>But I get a syntax error: <code>SyntaxError: Unexpected token (</code></p>
