title: How to return a default value from a Map?
body: <p>Using the ES6 Proxy object it is possible to return a default value when a property does not exist in a plain object.</p>
  
  <p><a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Proxy" rel="noreferrer">https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Proxy</a></p>
  
  <p>How to do this with a Map? I have tried the following code but the default value is always returned:</p>
  
  <pre><code>var map = new Map ([
      [1,  'foo'],  // default
      [2,  'bar'],
      [3,  'baz'],
  ]);
  
  var mapProxy = new Proxy(map, {
      get: function(target, id) {
          return target.has(id) ? target.get(id) : target.get(1);
      },
  });
  
  console.log( mapProxy[3] );  // foo
  </code></pre>