Assuming 'foo' is a function that returns a true/string/object on success, false/null/undefined on failure, is this valid and/or bad form?

function foobar() {
        var bar = foo() || return E_FAIL;

        // ....
}

IE: can I shortcut to a statement rather than an r-value (?)

There are many times I find myself doing

var foo = someFunction();
if (! foo) {
        return E_FAIL;
}

and thought I might start being a bit more efficient.

All assuming the failure is a 'normal' mode of operation.
_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners

Reply via email to