Edit: The link provided below by faintsignal is the most applicable answer. It not only explains why this behavior occurs but offers a solution to the stated problem.
I've got an array that I would like to determine if all elements are equal to a single value. The following code seems like it should work, but it doesn't. Can anyone explain?
var array1 = ['foo', 'bar', 'baz'];
var array2 = ['foo', 'foo', 'foo'];
//I expect this to be false and it is
new Set(array1) == new Set(['foo']);
//I expect this to be true and it is not
new Set(array2) == new Set(['foo']);
Any information would be most welcome!