title: Sort a JavaScript object by key or value; ES6
body: <p>Before I ask; there are a bunch of discussions on this particular subject, most of which pertain to ES5 and do not necessarily hold truth for ES6. I'm attempting to get some clarification, and maybe help the next person that is scouring the internet for an answer. <strong>This is in reference to ES6 specifically</strong>.</p>
  <h1>QUESTIONS:</h1>
  <p>Consider the following object structure:</p>
  <pre><code>const unsorted_object = {
      'C': '0003',
      'D': '0004',
      'A': '0001',
      'B': '0002',
      'F': '0005',
  }; 
  </code></pre>
  <ol>
  <li><p>How can I sort a JavaScript object by key? (Answered <a href="https://stackoverflow.com/questions/5467129">here</a>)</p>
  <pre><code>const sorted_object = {};
  Object.keys(unsorted_object).sort().forEach(function(key) {
      sorted_object[key] = unsorted_object[key];
  });
  </code></pre>
  </li>
  <li><p>How can I sort a JavaScript object by the key value?</p>
  </li>
  </ol>
  <h1>EDIT #1</h1>
  <p>I might not have been totally clear on question #2. The idea is to sort the JavaScript object by the value of the key, not by key and value.</p>
  <h1>EDIT #2</h1>
  <pre><code>const unsorted_object = {
      '0001': '13.1666',
      '0002': '11.0001',
      '0003': '10.6664',
      '0004': '13.1666',
      '0005': '7.3331',
  };
  </code></pre>
  <blockquote>
  <p>Output:</p>
  <pre><code>'0001': '13.1666'
  '0004': '13.1666'
  '0002': '11.0001'
  '0003': '10.6664'
  '0005': '7.3331'
  </code></pre>
  </blockquote>