Strange behavior of 'return' statement in JavaScript
<p>I am quite new to JavaScript and just started some more serious development in JavaScript.  I had a lot of fun implementing the Module pattern.  One thing that really drove me crazy was the behavior of the 'return' statement.  It is a big difference if you write </p>

<pre><code>Test = ( function()
{
    var message = "Hello World!";

    return
    {
        // Does not work
        printTest: function() { window.alert(message); }
    };
}());
</code></pre>

<p>or</p>

<pre><code>Test = ( function()
{
    var message = "Hello World!";

    return {
        // Works well
        printTest: function() { window.alert(message); }
    };
}());
</code></pre>

<p>Note the curly brace after the 'return' statement.</p>

<p>Is that a typical stupid rookie error and is well documented somewhere?</p>

<p>Firebug was not able to give a hint.  IE9 and Chrome did report some obscure syntax error at a later location in the code: the opening brace after the '<code>function</code>' statement in "<code>printTest: function()</code>".</p>

<p>Any comments on this?  Are there more such pitfalls in JavaScript?</p>
