Looking for some advice on my little project.
As an example, I have these two arrays
selectedItems = ['a', 'b', 'c', 'd', 'z']
availableItems = ['a', 'c', 'x', 'z']
What I'd like to achieve is to compare my selectedItems array with my availableItems array. If the items in selectedItems is not found in availableItems, then it will be removed from selectedItems
result:
selectedItems = ['a' 'c', 'z']
availableItems = ['a', 'c', 'x', 'z']
I know I can easily achieve this with a couple of for-loops, however I'd like to know if there is a better approach to do this with Javascript