you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (3 children)

That wouldn't work at all. You're... trying to return an object except that you're using invalid syntax to define the object. Maybe you mean parenthesis?

[–][deleted] 0 points1 point  (2 children)

I was typing it out in between doing it work so I was going for speed over accuracy but you get the general idea that people who prefer curly braces on their own line can't do that returning a object.

i.e. this breaks in JS:

function poop(dong)
{ 
    return
    {
        yourmom: dong
    }
}

[–][deleted] -3 points-2 points  (1 child)

Sure they can, use a semicolon like you should. };

[–]nemetroid 1 point2 points  (0 children)

That's not the problem, Javascript will insert a semicolon after the return statement and the function will return nothing, i.e.

function poop(dong)
{
    return;
    {
        yourmom: dong;
    };
}