What is the most efficient way to check more than one variable is true in a conditional statement? Please see my example below
var a = "Complete";
var b = "Complete";
var c = "Complete";
var d = "Complete";
var e = "Complete";
//make this more efficient
if (a == "Complete" && b == "Complete" && c == "Complete" && d == "Complete" && e == "Complete") {
//do something
}
Thanks for your help.
With only 5 vars what you’ve got is probably just fine, but you could do something like this instead:
The
everymethod returnstrueif all items pass the condition, otherwise it returnsfalse.