I just want to check I'm doing this right. I have a variable bar that starts false and is set true if a function foo() returns false, however I check foo() against several arguments and don't want bar returning to false if it is ever set true. This is what I've written:
var bar = false;
var collection = []; // this is filled with arguments for foo
for(var i = 0; i < collection.length; i++) {
bar = !foo(collection[i]) || bar;
}
Should that do the trick? Or is there maybe a simpler way?
varfor the variable "i" in the loop!false," do you mean "being set tofalse"? Variables do not return, only functions do.