Using ES6 sets, I can do this:
let ints = new Set([1,2,3])
console.log(ints.has(3))
And it prints true
because 3
is in the set.
But what about arrays? E.g.
let coordinates = new Set([[1,1], [1,2], [2,0]])
console.log(coordinates.has([1,2]))
this prints false
.
As you can see in this CodePen demo
So, without first turning the coordinates into strings (e.g ['1,1', '1,2', '2,0']
) how can I work with arrays in sets as if the array was something hashable?