[Project_owners] Is this valid JS?

Kovacs Baldvin baldvin at cs.elte.hu
Wed Mar 15 22:23:49 EST 2006


> I think that best practices in coding method or function is to have
> only  one entry point (easy to do) and only one exit point at the end
> of the method of function (avoid return in the middle of the code).

Come on guys, his question was not about wether it is good or bad coding
practice to use several return statements. (I am actually with him
on this issue. I think

var something = foo() || return E_FAIL;

is way more readable than the spaghetti with the tons of braces.)

We could argue about it, but that doesn't lead anywhere. However,
the question he asked still interests me, and I don't know the answer:

Is the construct shown above correct, and officially supported in
javascript, or is it not?

Best regards,
Baldvin


More information about the Project_owners mailing list