I'm trying to check for an if condition iteratively inside a for loop. That means some expressions of if conditions need to be generated iteratively as shown in the below example
let union = [1,2,3,4,5,6,7,8,9]
let control = [2,4,6]
let result = []
for(let i=0; i<union.length; i++){
if(union[i] % 2 == 0 && union[i] !== control[i]){
result.push(union[i])
}
}
In the above example union[i] !== control[i]
is the conditional expression that need to be validated/generated iteratively. In words we can state the problem as
result array should contain only even numbers from the union array and it should not contain any element from the control array
So the result array should be [8]