Javascript assumes end of statement at any line break where it's possible. For example this:
return
true;
is interpreted as:
return;
true;
turning the return and it's argument into two separate statements, which of course means that the function has no return value (returns undefined).
I wrote a blog entry about that a while back.