Compare 2 arrays (current and previous attributes) and return values in current attributes that are not in the previous attributes array that can be mapped to subsequent modules

I have a webhook returning this basic structure:

    currentAttributes: ['val1', 'val2', 'val3'],
    prevAttributes: ['val1', 'val2']

I want to compare the 2 arrays and extract the value(s) from currentAttributes that are not in prevAttributes. In this example, I would need to extract the 'val3' string.

I need to be able to pass this string into another search step to find an item named val3

I’ve seen solutions using filters to continue the scenario if an array contains/does not contain a value, but a filter won’t work in this case because I need to pass along the unique value.

I’ve tried merging and deduplicating the array, but of course, a deduplicated array ['val1', 'val2', 'val3', 'val1', 'val2'] will still return ['val1', 'val2', 'val3'].

I’m thinking something along the lines of using the map() and/or toCollection() methods might be useful, but I’m still stuck on comparing and filtering to return only the value I want.

Basically the functionality I need would be this code:

const array1 = ["companyOne", "companyTwo", "companyThree"];
const array2 = ["companyOne", "companyTwo"];

const result = array1.filter(item => !array2.includes(item));

console.log(result); // This will log ["companyThree"]

Any advice is greatly appreciated, thanks!