Is there a simple way to verify that an ES6 Set contains a value that is a particular array? I'd like a solution that doesn't require me to use a reference:
var set = new Set();
var array = [1, 2];
set.add(array);
set.has(array); // true
set.add([3, 4]);
set.has([3, 4]); // false
So far my solution is to store everything as a string, but this is annoying:
set.add([3, 4].toString());
set.has([3, 4].toString()); // true
See Question&Answers more detail:os