I am currently working on checking an iterative if condition within a for loop. This involves generating some expressions for the if conditions iteratively, as demonstrated in the example below:
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 this example, union[i] !== control[i]
is the conditional expression that needs to be validated/generated iteratively. To put it simply,
The result array should only include even numbers from the union array and not any element from the control array.
Therefore, the resulting array should be [8]