Looking at a couple of different docs, all I see is when the Map (ECMAScript6) key is a boolean, string, or integer. Is there a way we could use another customized Object (called with the new CustomObject(x,y) constructor call) to be added as a key?
I am able to add an object as a key, but unable to check if the Map has the said object.
var myMap = new Map();
myMap.set( new Tuple(1,1), foo);
myMap.set('bar', foo);
myMap.has(?);
myMap.has('bar'); // returns true
Is there a way around this?
var myMap = new Map();
myMap.set( new Tuple(1,1), foo);
for(some conditions) {
var localData = new Tuple(1,1); //Use directly if exists in myMap?
map.has(localData) // returns false as this is a different Tuple object. But I need it to return true
}
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/has