I had issue with set.has()
method. I have a set that has a two dimensional array that shows the index of another two dimensional array. When I want to check that the set contains an index it always returns false
.
Here is the code:
var indexes = new Set();
while (indexes.size < 10) {
indexes.add(randomIndex());
}
function randomIndex() {
i = Math.floor(Math.random() * 9);
j = Math.floor(Math.random() * 11);
return [i, j];
}
indexes.has([i,j]);