I am attempting to save a key as an object in JavaScript by using the Map collection:
let tempEntry = {y:y, x:x}
let exist = map1.has(tempEntry);
if(exist){
map1.set(tempEntry, true)
} else {
map1.set(tempEntry, false)
}
However, I am facing an issue where it cannot find the key and always returns exist as false. I have a list where I also take the x and y values and put them in the tempEntry variable.
What I aim to accomplish is to create a list of objects with the format key: {y:y, x:x}, value: true/false.
Does anyone have an alternate method to achieve this?