0

Does anyone know a good way to force javascript to evaluate all operands in a boolean expression?

In particular, what I am tring to do is essentially this:

return isValid(a) && isValid(b) && isValid(c);

while this technically does work, the function is responsible for highlighting invalid areas on the form for user attention. Since the && operator short circuits, it will only ever highlight the first invalid expression, possibly requiring the user to go through several rounds of correcting input data.

Any ideas?

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by |-|x
0

Thanks Pritaeas, that will work although less eligant than I like.

I guess the ultimate answer to my question, as my far as research has shown anyway, is that there is no way to not short-circuit boolean operations in javascript.

Kind of limiting if you ask me, but eh.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.