title: Javascript map use HTMLElement as key
body: <p>As title suggests,  I'm using HTMLElement as key to javascript's map container</p>
  
  <p>consider the following example</p>
  
  <pre><code>let map =  new Map(), 
      nodeA = document.createElement("b"), 
      nodeB = document.createElement("b");
  map[nodeA] = 5;
  console.log(map[nodeB]); // prints 5
  </code></pre>
  
  <p>now clearly nodeA.isSameNode(nodeB) would give you false.</p>
  
  <p>After playing around it for a bit, I found that Map would treat elements with the same tag name as being "equal", doesn't matter if they are actually the same node.</p>
  
  <p>Is there a way to get around this behavior? i.e. I would want different nodes being treated as different keys.</p>
  
  <p><strong>edit</strong> thanks MarcelD for pointing out. I meant to say map[nodeB] as fixed, and thanks to the answers. Stupid mistake</p>