I have two arrays with different types of complex objects. If there is a certain match of values between objects of each array then I need to take a few values from one of the matching objects and save it. If a few key value pairs from within a matching object get saved then it needs to be removed from its array so that it does not get saved more than once.

The following is my best effort (so far to show an example of what I'm trying to do).

I want to update my empty array based on the code that follows. This is a simple example to illustrate a much more complex problem and I think it's probably a better way to go than cutting and pasting dozens of lines of code. The issue has to do with collecting values in the emptyArray and filtering array2 during each passing of the outer loop. Suggestions leading with underscore are not helpful.

```
var array = [1, 2, 3, 4, 1, 2, 3, 4];
var array2 = [2, 4, 6, 8, 10];
var emptyArray = [];
for (i = 0; i < array.length; i++){
     var something = array[i];
     var array2 = _.without(array2, emptyArray);
     for (a = 0; a < array2.length; a++){
         var value = array2[a];
          if(something === value){
              emptyArray.push(value);
              break;
          }
     }
}

```

I want to update the values in array2 based on the if statement so that those values are not repeated in the nested loop. Instead my emptyArray remains empty instead of adding values from the array2 as elements of array2 are equal to elements of array.

To be clear, right now emptyArray remains empty and never filters array2.
I'd like to see empty array collect value 2 at the start of the outer loop's second iteration then I'd like to see emptyArray collect value 4 at the start of the 4th iteration of the outer loop. 

I'd want to filter each of these values from array2 as they become part of emptyArray so that they do not set off the if statement during the 6th and 8th iterations of the outer loop. I imagine that emptyArray = [2, 4] and array2 = [6, 8, 10] when the loops are finished.