let objectArray1 = [{key1: 1}, {key2: 2}, {key3: 3}];
let objectArray2 = [{operator: LESS THAN}, {operator: GREATER THAN}, {operator: NOT EQUAL}];
In this scenario, the goal is to combine each object in objectArray2 with the corresponding object in objectArray1. For example, merge object at index 0 in objectArray2 into the object at index 0 in objectArray1 and so on.
//result = [{key1: 1, operator: LESS THAN}, {key2: 2, operator: GREATER THAN}];
During or after merging, it is required to iterate through each resulting object and create a new object with properties (field, input, operator) which are then pushed into an array.
field = key from objectArray1 (key1, key2, key3)
input = value from objectArray1 (1, 2, 3)
operator = "operator" from objectArray2
// let endResult = [{field: key1, input: 1, operator: LESS THAN}, {field: key2, input: 2, operator: GREATER THAN}];
Thank you!