[Project_owners] Is this valid JS?

Adam Judson adamsplugins at gmail.com
Wed Mar 15 15:35:46 EST 2006


Agreed.

I'd prefer to see

var retVal = E_FAIL;
var foo = f();
if (foo) {
   // do other stuff
   retVal = NOT_FAIL;
}
return retVal;

e.g. one return with tests for success rather than lots of returns on failure.
But maybe I just like braces...

A


On 15/03/06, Alex Vincent <ajvincent at gmail.com> wrote:
> I'd actually advise against any such shortcut, as they make the code
> less readable, and debugging thus becomes harder.  For this kind of
> optimization, I don't see that it's worth it.
>
> --
> "The first step in confirming there is a bug in someone else's work is
> confirming there are no bugs in your own."
> -- Alexander J. Vincent, June 30, 2001
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
>


More information about the Project_owners mailing list