title: How to sort map of objects by values ascendingly
body: <p>I have the map posted below in the code section. what i want to achieve is, to sort the map according to the values ascendingly. so that, after sorting it,
  i should the map sorted as shown in last section.</p>
  
  <p>please let me know how can i achieve that.</p>
  
  <p><strong>code</strong>:</p>
  
  <pre><code>const obj1 = new Object();
  const obj2 = new Object();
  const obj3 = new Object();
  const obj4 = new Object();
  
  const map2 = {};
  map2[obj1] = 10;
  map2[obj2] = -20;
  map2[obj3] = 0;
  map2[obj4] = 40;
  </code></pre>
  
  <p><strong>after sorting</strong>:</p>
  
  <pre><code>map2[obj2] = -20;
  map2[obj3] = 0;
  map2[obj1] = 10;
  map2[obj4] = 40;
  </code></pre>