I have an instrestion question about boolean logiс in javascript.
I have a FOR circle and created a trigger event, which will store TRUE or FALSE for IF statement:
var trigger = [];
for (i = 0; i < 3; i++ ){
//Checking for empty fields
if(this.form.rows[i].fields[0].input.val() === '') {
if($(this.form.rows[i].row[0]).length){
bla bla bla
trigger.push(true)
}
else {
trigger.push(false);
}
}
So in the end I want to check each statement of array for boolean operator AND
if(trigger & ??? )
Any help friends ?
trueis in the array or test whether all entries aretrue? What else are you doing withtrigger? Do you need an array at all?&is bitwise AND btw.'111' & '111'actually returns111. I honestly suggest you to take some more time to phrase your question properly. It is not easy to understand what you want to do (or maybe it's just me who does not understand it).&&.. if you want to check if 2 variables have the same value you can use==or===for both value and type (strict comparison) checkstrueto the array and later test whether$counter === 3?