let key = [1,2]
let m = new Map()
m.set(key, "12")
console.log(m.get(key)) // 12
console.log(m.get([1,2])) // undefined
Why is it that when I want to get a value not by the name of the key variable but by the value [1,2], there is no such thing And if you add so
m.set([1,2], "12")
m.set([1,2], "123")
m.set([1,2], "1234")
about the map will be
Map(4) { (2) […] → "12", (2) […] → "12", (2) […] → "123", (2) […] → "1234" }
size: 4
<entries>
0: Array [ 1, 2 ] → "12"
1: Array [ 1, 2 ] → "12"
2: Array [ 1, 2 ] → "123"
3: Array [ 1, 2 ] → "1234"