Take the following arrays.
arrayOne = ["a", "b", "c", "d"];
arrayTwo = ["a", "b", "c", "d", "e", "f", "g"];
arrayThree = ["a", "b", "d", "g", "i"]
Assume I want to make sure that for every string in arrayOne, it is present in the other array I am matching it too.
Take a real life example, I want to make sure I have completed my shopping list, so I take out my shopping list and see that each item on my shopping list is present in the cart. There may be more items in my cart then in the shopping list, but as long as every item is there I am good.
Back to JavaScript, comparing arrayTwo against arrayOne returns true because a, b, c, and d are all present, while comparing arrayThree against arrayOne return false because c is not present.
I know this could be acomplished using a for loop with indexof, but is there a more elegant way to do it?


subset.every(x => set.includes(x))