I am working with two arrays of strings, array1 and array2, that I need to compare. I want to find a way to check if all elements from array2 are present in the elements of array1, and then create a new array based on this comparison. I believe using filter + includes is the right approach for my scenario. I came across a helpful answer related to my question.
To clarify, here is an example of what I am trying to achieve and what the expected result should look like:
array1 [ 'apple_mango_banana', 'mango_apple_banana', 'apple_banana' ]
array2 [ 'apple', 'mango' ]
result ['apple_mango_banana', 'mango_apple_banana' ]