0

I have a map in JavaScript. When I check to see if an array is in the map, it returns false even though it is clearly in it. Here is the code:

var map = new Map([[[1, 2], 4]]);
for (let key of map.keys()) {
  console.log(key)
}
console.log(map.has([1, 2]))

Why does the .has method not work with arrays?

Or Assayag
  • 5,662
  • 13
  • 57
  • 93
  • [Why are two identical objects not equal to each other?](https://stackoverflow.com/q/11704971) – VLAZ Jan 09 '21 at 20:57
  • 1
    See also: [Using Array objects as key for ES6 Map](https://stackoverflow.com/q/32660188) | [How to check if Javascript Map has an object key](https://stackoverflow.com/q/44956867) – VLAZ Jan 09 '21 at 21:02

0 Answers0