Update: After reviewing the link shared by faintsignal, it appears to be the most suitable answer. It not only clarifies why this behavior is happening but also provides a solution to the issue at hand.
I am currently working with an array and trying to determine if all elements are equal to a single value. The code snippet below seems like it should accomplish this task, however, it is not producing the expected outcome. Can someone shed some light on this?
var array1 = ['foo', 'bar', 'baz'];
var array2 = ['foo', 'foo', 'foo'];
//I anticipate this to be false, which it is
new Set(array1) == new Set(['foo']);
//I anticipate this to be true, but it is not
new Set(array2) == new Set(['foo']);
Any insights or information regarding this matter would be greatly appreciated!