title: How to check if a Map or Set is empty?
body: <p>With a traditional object in JavaScript, it is easy enough to check if it is empty using the <code>Object.keys</code> method:</p>
  
  <pre><code>const emptyObj = {};
  console.log(Object.keys(emptyObj).length === 0);  // true, i.e. "empty"
  
  const populatedObj = { foo: 'bar' };
  console.log(Object.keys(populatedObj).length === 0);  // false, not empty
  </code></pre>
  
  <p>Although a bit redundant, you can use the same approach with arrays too if you like:</p>
  
  <pre><code>const emptyArr = [];
  console.log(Object.keys(emptyArr).length === 0);  // true
  
  const populatedArr = [1, 2, 3];
  console.log(Object.keys(populatedArr).length === 0);  // false
  </code></pre>
  
  <p>However, ES6's handy new data structures <em>Map</em> and <em>Set</em>, don't work the same way. If you try to use <code>Object.keys</code> on them you will <em>always</em> get an empty array!</p>
  
  <pre><code>const populatedSet = new Set(['foo']);
  console.log(Object.keys(populatedSet).length);  // 0
  
  const populatedMap = new Map([['foo', 1]]);
  console.log(Object.keys(populatedMap).length);  // 0
  </code></pre>
  
  <p>So what is the best way to check whether or not your fancy new ES6 structures are populated? Also, is there some sort of single overloaded method that would work for objects, arrays, Maps, <em>and</em> Sets?</p>