I have these arrays:
x = ['a','b','c','d']
y = ['b','c','e']
I’d like to get rid of the commonalities in x and y and ignore the non-commonalities in y.
Ideally, when I do something to the two arrays, I would get ['a','d'].
Is there something that does this in Ruby?
The
-method, “array difference”, returns a new array that is a copy of the original array,removing any items that also appear in the second one.