I spent a fair bit of time on this Javascript issue (you can tell I am a JS noob):
Take some well written Javascript code like this example of the Revealing Module Pattern:
Running it works fine. Then move the "{" to the next line (as a C# developer I set up all my environments to put curly braces on new lines) and run it again.
return
{
someMethod : myMethod,
someOtherMethod : myOtherMethod
};
It now gets quite a few JS errors around "13 Line breaking error 'return'." and "Uncaught SyntaxError: Unexpected token : " in Chrome Debugger.
My question is, how can something syntactically affect the Javascript like this?
I have set it up here in JSFiddle (to get it to work, move the { after "return" back on to the same line)
{ foo: 'bar' };
statement is syntactically incorrect – Ritenuto